C#: Image to byte array
Image to byte array
- public static byte[] imageToByteArray(Image imageIn)
- {
- MemoryStream ms = new MemoryStream();
- imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
- return ms.ToArray();
- }
Tag: Bytes, image, C#
seaman
30th May 2013, 08:07
А поток закрывать не надо?
AndrewSt
31st May 2013, 11:48
вот так будет лучше https://snippets.pro/snippet/119-c-sharp-image-to-byte-array-2/
RedOctober
31st May 2013, 13:49
Testing BB-codes: bold text, italic text, some code here
stalin
3rd June 2013, 08:54
AndrewSt, верно, я не позаботился о ресурсах вовремя.