Hi everyone,
I am trying to write an array of bytes to a Bitmap. The array of bytes contains only the bitmap data (no header info, simply the pixels).
I know the PixelFormat and the size of the Bitmap and I have the data. What I want to know is how to put this data into the Bitmap.
Here is how am I trying to do this:
I would appreciate any help or suggestions from you guys.
Thanks in advance
I am trying to write an array of bytes to a Bitmap. The array of bytes contains only the bitmap data (no header info, simply the pixels).
I know the PixelFormat and the size of the Bitmap and I have the data. What I want to know is how to put this data into the Bitmap.
Here is how am I trying to do this:
Code:
/// <summary>
/// function CopyDataToBitmap
/// Purpose: Given the pixel data return a bitmap of size [352,288] and with PixelFormat=24RGB
/// </summary>
/// <param name="data">Byte array with pixel data</param>
public Bitmap CopyDataToBitmap(byte[] data)
{
//I
Bitmap bmp = new Bitmap( 352, 288, PixelFormat.Format24bppRgb);
//Here the code to put data array into Bitmap
//Unfortunatelly i dont know how :(
//Return the bitmap
return bmp;
}
I would appreciate any help or suggestions from you guys.
Thanks in advance