I use the console output BMP PixelFormat, type of Format8bppIndexed
Public static byte [] GetByteData Bitmap (BMP)
{
BitmapData bmpdata=https://bbs.csdn.net/topics/null;
Bmpdata=https://bbs.csdn.net/topics/bmp.LockBits (new Rectangle (0, 0, BMP. Width, BMP, Height), ImageLockMode. ReadOnly, BMP. PixelFormat);
Int numbytes=bmpdata. Stride * BMP. Height;
Byte [] bytedata=https://bbs.csdn.net/topics/new byte [numbytes];
IntPtr PTR=bmpdata. Scan0;
Marshal. Copy (PTR, bytedata, 0, numbytes);
Return bytedata;
}