simple Code Snippets to Convert Image to Byte Array and Vise Versa
Image To Byte Array Function
public byte[] imageToByteArray(System.Drawing.Image imageIn)
{
MemoryStream ms = new MemoryStream();
imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
return ms.ToArray();
}
public Image byteArrayToImage(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}
de Source 0 Light Poster
sandeepparekh9 109 Posting Whiz
de Source 0 Light Poster
CsharpChico 1 Junior Poster in Training
sandeepparekh9 109 Posting Whiz
Teme64 215 Veteran Poster
CsharpChico 1 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.