I have following code to create bitmap using array with data*
//Here create the Bitmap to the know height, width and format
Bitmap bmp = new Bitmap( 5,7,PixelFormat.Format1bppIndexed);
//Create a BitmapData and Lock all pixels to be written
BitmapData bmpData = bmp.LockBits(
new Rectangle(0, 0, bmp.Width, bmp.Height),
ImageLockMode.WriteOnly, bmp.PixelFormat);
//Copy the data from the byte array into BitmapData.Scan0
Marshal.Copy(data, 0, bmpData.Scan0, data.Length);
//Unlock the pixels
bmp.UnlockBits(bmpData);
bmp.Save("BitMapIcon.bmp",ImageFormat.Bmp);
My input array (data ) :
byte[5] data = {0xff,0xff,0xff,0xff,0xff}
Question :
- Can array of data* for bitmap input have only valu of each pixel (in this format it is 0 and 1 ) ?
- Why passing array of 0xff value some of pixel are not black ?
- Can width size be less than 1 byte ?