how to convert byte array to bitmap in c#


  • Another way exists.

    Code Block

    TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap));

    Bitmap bitmap1 = (Bitmap)tc.ConvertFrom(byteArray);


    Code Block

    ImageConverter ic = new ImageConverter();

    Image img = (Image)ic.ConvertFrom(byteArray);

    Bitmap bitmap1 = new Bitmap(img);


    Tuesday, December 25, 2007 7:31 AM
  • To some extent that would seem to depend on the contents of the array.


    One approach would be to wrap an instance of the MemoryStream class around the byte array and then create an instance of the Bitmap class by calling the Bitmap (Stream) constructor.


    Tuesday, December 25, 2007 7:15 AM

All replies