Some time ago for a period of time image acquisition, BMP format and JPG pictures and further in-depth research, this blog will first introduce the structure of BMP format files, browsing a lot of information online, found that there are a lot of Daniel in this study quite deep ... Here's what they have to learn from ...
First, the contents of the entire BMP file can be divided into 3 to 4 pieces. There are 3 to 4 blocks instead of fixed values because there may be a palette or some masks for BMP. Discuss this in detail.
The first block is the BMP file header used to describe the situation of the entire BMP file. The structure is as follows:
Typedefstruct tagbitmapfileheader
{
WORD bftype;
DWORD bfsize;
WORD bfReserved1;
WORD BfReserved2;
DWORD bfoffbits;
} Bitmapfileheader, *pbitmapfileheader;
This information is quite useful if you want to parse the BMP file directly. The first bftype is used to represent the file type, and if it is a BMP file, then the value of this position must be "BM" or 0x4d42. The second bfsize represents the number of bytes in the entire file. The third fourth is reserved, currently meaningless, the last is very important, said, bitmap data information from the file header offset, in bytes.
First, the contents of the entire BMP file can be divided into 3 to 4 pieces. There are 3 to 4 blocks instead of fixed values because there may be a palette or some masks for BMP. Discuss this in detail.
The first block is the BMP file header used to describe the situation of the entire BMP file. The structure is as follows:
Typedefstruct tagbitmapfileheader
{
WORD bftype;
DWORD bfsize;
WORD bfReserved1;
WORD BfReserved2;
DWORD bfoffbits;
} Bitmapfileheader, *pbitmapfileheader;
This information is quite useful if you want to parse the BMP file directly. The first bftype is used to represent the file type, and if it is a BMP file, then the value of this position must be "BM" or 0x4d42. The second bfsize represents the number of bytes in the entire file. The third fourth is reserved, currently meaningless, the last is very important, said, bitmap data information from the file header offset, in bytes.
Reference from:http://blog.csdn.net/jurrah/article/details/4163333
There is also a Daniel's blog that is also very exciting http://www.cnblogs.com/beer/archive/2010/11/21/1883054.html
Http://www.blogjava.net/georgehill/articles/6549.html
This article is from the "Late Evening" blog, please be sure to keep this source http://yiluohuanghun.blog.51cto.com/3407300/864001