Hi people,
Using a FEZ Spider I have some problems converting a byte array into a bmp. Here is my code:
Bitmap imgSave = new Bitmap(bmpArray, Bitmap.BitmapImageType.Bmp);
displayTE35.SimpleGraphics.DisplayImage(imgSave, 0, 0);
I don’t get any compilation error. With a step by step debugging, the program stops in the first row (of the code above). Can someone help? Are there different ways to convert from byte array to bmp?
Further Information
The byte array (bmpArray) is sent to the board from a WCF Service. On the board, I have to translate it into a bmp and to display it.
I’m not a specialist in bmp too
I used this piece of code to translate from bmp to byte array
Image original = Image.FromFile(@ "C:\Temp\sky.bmp");
MemoryStream memStream = new MemoryStream();
original.Save(memStream, System.Drawing.Imaging.ImageFormat.Bmp);
// Set the position to the beginning of the stream.
memStream.Seek(0, SeekOrigin.Begin);
// Read the first 20 bytes from the stream.
byteArray = new byte[memStream.Length];
int count = 0;//memStream.Read(byteArray, 0, 20);
len = byteArray.Length;
// Read the remaining bytes, byte by byte.
while (count < memStream.Length)
{
byteArray[count++] = Convert.ToByte(memStream.ReadByte());
}