BMP file format

Source: Internet
Author: User

A bmp file consists of four parts: File Header, bitmap information header, color information, and image data:

Bitmapfileheader
Bitmapinfoheader
Bitmap color table rgbquad
Bitmap pixel data

1. Bitmap File Header

The bitmap file header contains information such as the type, size, and start position of the BMP file. Its structure is defined as follows:

Typedef struct tagbitmapfileheader {word bftype; // The type of the bitmap file, which must be bmp dword bfsize; // the size of the bitmap file, in bytes: Word bfreserved1; // reserved words of the bitmap file, it must be 0 word bfreserved2; // reserved word of the bitmap file, which must be 0 DWORD bfoffbits; // the starting position of the bitmap data, expressed in bytes as the offset relative to the file header} bitmapfileheader;

2. Bitmap header

The structure of the BMP bitmap information header is used to describe the size and other information of the bitmap. Its structure is as follows:

Typedef struct tagbitmapinfoheader {DWORD bisize; // The number of bytes occupied by this structure long biwidth; // The width of the bitmap, in pixels long biheight; // The height of the bitmap, in pixels, word lanlanes; // The level of the target device, which must be 1 word bibitcount; // The number of digits required for each pixel, which must be 1 (two-color ), 4 (16 colors), 8 (256 colors), or 24 (true color) One DWORD bicompression; // bitmap compression type, must be 0 (not compressed), 1 (bw.rle8 compression type) or 2 (bw.rlb4 compression type) DWORD bisizeimage; // bitmap ing, in bytes long bixpelspermeter; // bitmap horizontal resolution, in pixels/meters long biypelspermeter; // bitmap vertical resolution, in the unit of pixels/meters DWORD biclrused; // number of colors in the color table used by the bitmap DWORD biclrimportant; // number of important colors in the bitmap display process} bitmapinfoheader

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.