Question : how to Convert a Byte[] to Bitmap ?

Jan 30 2008 2:51 AM

Hello,

I have a problem with the conversion of a byte[] object into a bitmap object.

My object is defined as follow :

byte [] myObject.Image; //(this is the type the Intellicense send me)

I try to convert this variable into a bitmap type like this :

MemoryStream ms = new MemoryStream(myObject.Image);

Bitmap bmp = new Bitmap(new System.IO.MemoryStream(ms));

I define a MemoryStream(byte[] buffer) but when I build my project, and tough the type seems correct, I have this error :

Error :  The best overloaded method match for 'System.IO.MemoryStream.MemoryStream(int)' has some invalid arguments C:\mypath.cs 3582 49 myProject

Can someone help me ?

TIA

 

 

 

 


Answers (2)