Answers for "c# bytes to image"

C#
3

c# image to byte array

public byte[] ImageToByteArray(System.Drawing.Image imageIn)
{
   using (var ms = new MemoryStream())
   {
      imageIn.Save(ms,imageIn.RawFormat);
      return  ms.ToArray();
   }
}
Posted by: Guest on May-28-2020
0

c# bytes to image

MemoryStream ms = new MemoryStream(byteArrayIn,0,byteArrayIn.Length);
ms.Position = 0; // this is important
returnImage = Image.FromStream(ms,true);
Posted by: Guest on November-24-2021

C# Answers by Framework

Browse Popular Code Answers by Language