|
png and bmp are similar, a large section of the head is all kinds of information of the picture, followed by the color data of each pixel (256-color palette, 24-bit ARGB), you can use GDI+
bitmap = new Bitmap(L"sample.png");
pixelFormat = bitmap->GetPixelFormat(); //such as PixelFormat24bppRGB, PixelFormat8bppIndexed
width = bitmap->GetWidth();
height = bitmap->GetHeight();
rect.X = 0;
rect.Y = 0;
rect.Width = width;
rect.Height = height;
bitmap->LockBits(rect, ImageLockModeWrite, pixelFormat, bitmapData); //Read the picture into bitmapData, and then you can operate
p = (byte *) bitmapData->Scan0; //bitmapData->Scan0 is the first pixel of the picture
You can deal with the above |
|