T
topdawg147
I'm trying to convert an image to a byte array. However, when i do this
something is getting changed in the bytes (contents, length, etc). I
know because I'm also looking at the image bytes in a hex editor. I
want the image bytes in the program to match those that i'm looking at
in the hex editor. I'm not sure if it's an encoding thing or something
else.Here's the code I'm using:
Public Function ToArray(System.Drawing.Image img)
Dim ms As MemoryStream = New MemoryStream()
img.Save(ms, System.Drawing.Imaging.ImageFormat.Tiff);
Return ms.ToArray()
End Function
Also, I'd like to not have to specify the ImageFormat type.
Thanks,
todd
something is getting changed in the bytes (contents, length, etc). I
know because I'm also looking at the image bytes in a hex editor. I
want the image bytes in the program to match those that i'm looking at
in the hex editor. I'm not sure if it's an encoding thing or something
else.Here's the code I'm using:
Public Function ToArray(System.Drawing.Image img)
Dim ms As MemoryStream = New MemoryStream()
img.Save(ms, System.Drawing.Imaging.ImageFormat.Tiff);
Return ms.ToArray()
End Function
Also, I'd like to not have to specify the ImageFormat type.
Thanks,
todd