Bitmapsize = BMP. bmwidthbytes * BMP. bmheight; In this experiment, we learned a lot about BMP images, including basic components and operations (such as amplification and reduction ). The following is the dib file format:
This is the composition of a BMP image. It can be regarded as its data structure, which stores the data needed to display the image. The data in the Structure Body is complex, but here are some points.
Offsetbit is the displacement from the file header to the pixel;
Imagesize is the size of pixels;
Size indicates the size of the entire Dib file.
In the file header, offsetbit calculation is actually very simple, that is, the size of the file header and the information header add up (of course, the default is a 24-Bit Bitmap), but it is relatively simple because they are fixed sizes.
The imagesize calculation method looks complicated:
(M_bdbmpdata.width * 32) + 31)/32) * 4) * m_bdbmpdata.height. If the number of bytes occupied is a multiple of 4, use 0 to complete it.
If the information you prepare is complete, you can use the following formula for calculation:
Bitmapsize = BMP. bmwidthbytes * BMP. bmheight;
The first is the field in the bitmap structure, indicating the number of bytes occupied by each row.
Portal:
How was my first MFC small project (1) coming soon?
Bitmap conversion in my first MFC small project (3)
Troublemakers 2011-11-23