Can anybody suggest how I can convert an image to a byte array and vice versa?
I'm developing a WPF application and using a stream reader.
Sample code to change an image into a byte array
public byte[] ImageToByteArray(System.Drawing.Image imageIn) { using (var ms = new MemoryStream()) { imageIn.Save(ms,imageIn.RawFormat); return ms.ToArray(); } }
C# Image to Byte Array and Byte Array to Image Converter Class
1.4m articles
1.4m replys
5 comments
57.0k users