File Structure
The bitmap image file consists of fixed-size structures (headers) as well as variable-size structures appearing in a predetermined sequence. Many different versions of some of these structures can appear in the file, due to the long evolution of this file format.
Referring to the diagram 1, the bitmap file is composed of structures in the following order:
Structure Name | Optional | Size | Purpose | Comments |
---|---|---|---|---|
Bitmap File Header | No | 14 Bytes | To store general information about the Bitmap Image File | Not needed after the file is loaded in memory |
DIB Header | No | Fixed-size (however 7 different versions exist) |
To store detailed information about the bitmap image and define the pixel format | Immediately follows the Bitmap File Header |
Extra bit masks | Yes | 3 or 4 DWORDs (12 or 16 Bytes) |
To define the pixel format | Present only in case the DIB Header is the BITMAPINFOHEADER |
Color Table | Semi-optional | Variable-size | To define colors used by the bitmap image data (Pixel Array) | Mandatory for color depths <= 8 |
Gap1 | Yes | Variable-size | Structure alignment | An artifact of the File Offset to PixelArray in the Bitmap File Header |
Pixel Array | No | Variable-size | To define the actual values of the pixels | The pixel format is defined by the DIB Header or Extra bit masks. Each row in the Pixel Array is padded to a multiple of 4 bytes in size |
Gap2 | Yes | Variable-size | Structure alignment | An artifact of the ICC Profile Data offset field in the DIB Header |
ICC Color Profile | Yes | Variable-size | To define the color profile for color management | Can also contain a path to an external file containing the color profile. When loaded in memory as "non-packed DIB", it is located between the color table and gap1. |
Read more about this topic: BMP File Format
Famous quotes containing the words file and/or structure:
“While waiting to get married, several forms of employment were acceptable. Teaching kindergarten was for those girls who stayed in school four years. The rest were secretaries, typists, file clerks, or receptionists in insurance firms or banks, preferably those owned or run by the family, but respectable enough if the boss was an upstanding Christian member of the community.”
—Barbara Howar (b. 1934)
“Slumism is the pent-up anger of people living on the outside of affluence. Slumism is decay of structure and deterioration of the human spirit. Slumism is a virus which spreads through the body politic. As other isms, it breeds disorder and demagoguery and hate.”
—Hubert H. Humphrey (19111978)