Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Howto: image to byte array

Howto: image to byte array

Scheduled Pinned Locked Moved C#
questiondata-structures
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Smitha Nishant
    wrote on last edited by
    #1

    Hello all, What is the quickest way to convert an image to a byte array? Is it image -> file -> byte array ? Or is there a short cut ? Thanks Smitha Imagination is more important than knowledge. --Albert Einstein

    J 1 Reply Last reply
    0
    • S Smitha Nishant

      Hello all, What is the quickest way to convert an image to a byte array? Is it image -> file -> byte array ? Or is there a short cut ? Thanks Smitha Imagination is more important than knowledge. --Albert Einstein

      J Offline
      J Offline
      Jeff J
      wrote on last edited by
      #2

      Smitha Vijayan wrote: What is the quickest way to convert an image to a byte array? I am not sure if you mean performance or easiest to code, but you can just use the Image's Save method, and pass a MemoryStream instead of some sort of file stream. A MemoryStream can write to an array of bytes. Saving to a file would be very slow in performance, and not necessary in this case. Cheers

      S 1 Reply Last reply
      0
      • J Jeff J

        Smitha Vijayan wrote: What is the quickest way to convert an image to a byte array? I am not sure if you mean performance or easiest to code, but you can just use the Image's Save method, and pass a MemoryStream instead of some sort of file stream. A MemoryStream can write to an array of bytes. Saving to a file would be very slow in performance, and not necessary in this case. Cheers

        S Offline
        S Offline
        Smitha Nishant
        wrote on last edited by
        #3

        Thanks Jeff Smitha Imagination is more important than knowledge. --Albert Einstein

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups