Example 2
Following is an example of a 4×2 pixel, 32-bit bitmap with opacity values in the alpha channel (Windows DIB Header BITMAPV4HEADER) with pixel format 8.8.8.8.0 (in RGBAX notation).
Offset | Size | Hex Value | Value | Description |
---|---|---|---|---|
BMP Header | ||||
0h | 2 | 42 4D |
"BM" | Magic number (unsigned integer 66, 77) |
2h | 4 | 9A 00 00 00 |
154 Bytes | Size of the BMP file |
6h | 2 | 00 00 |
Unused | Application specific |
8h | 2 | 00 00 |
Unused | Application specific |
Ah | 4 | 7A 00 00 00 |
122 bytes from the start of the file | Offset where the pixel array (bitmap data) can be found |
DIB Header | ||||
Eh | 4 | 6C 00 00 00 |
108 bytes | Number of bytes in the DIB header (from this point) |
12h | 4 | 04 00 00 00 |
4 pixels | Width of the bitmap in pixels |
16h | 4 | 02 00 00 00 |
2 pixels | Height of the bitmap in pixels |
1Ah | 2 | 01 00 |
1 plane | Number of color planes being used |
1Ch | 2 | 20 00 |
32 bits | Number of bits per pixel |
1Eh | 4 | 03 00 00 00 |
3 | BI_BITFIELDS, no pixel array compression used |
22h | 4 | 20 00 00 00 |
32 bytes | Size of the raw data in the pixel array (including padding) |
26h | 4 | 13 0B 00 00 |
2,835 pixels/meter | Horizontal physical resolution of the image |
2Ah | 4 | 13 0B 00 00 |
2,835 pixels/meter | Vertical physical resolution of the image |
2Eh | 4 | 00 00 00 00 |
0 colors | Number of colors in the palette |
32h | 4 | 00 00 00 00 |
0 important colors | 0 means all colors are important |
36h | 4 | 00 00 FF 00 |
00FF0000 in big-endian | Red channel bit mask (valid because BI_BITFIELDS is specified) |
3Ah | 4 | 00 FF 00 00 |
0000FF00 in big-endian | Green channel bit mask (valid because BI_BITFIELDS is specified) |
3Eh | 4 | FF 00 00 00 |
000000FF in big-endian | Blue channel bit mask (valid because BI_BITFIELDS is specified) |
42h | 4 | 00 00 00 FF |
FF000000 in big-endian | Alpha channel bit mask |
46h | 4 | 20 6E 69 57 |
LCS_WINDOWS_COLOR_SPACE | Type of Color Space |
4Ah | 24h | 24* 00...00 |
CIEXYZTRIPLE Color Space endpoints | Unused when LCS_WINDOWS_COLOR_SPACE is specified |
6Eh | 4 | 00 00 00 00 |
0 Red Gamma | Unused when LCS_WINDOWS_COLOR_SPACE is specified |
72h | 4 | 00 00 00 00 |
0 Green Gamma | Unused when LCS_WINDOWS_COLOR_SPACE is specified |
76h | 4 | 00 00 00 00 |
0 Blue Gamma | Unused when LCS_WINDOWS_COLOR_SPACE is specified |
Start of the Pixel Array (the bitmap Data) | ||||
7Ah | 4 | FF 00 00 7F |
255 0 0 127 | Blue (Alpha: 127), Pixel (0,1) |
7Eh | 4 | 00 FF 00 7F |
0 255 0 127 | Green (Alpha: 127), Pixel (1,1) |
82h | 4 | 00 00 FF 7F |
0 0 255 127 | Red (Alpha: 127), Pixel (2,1) |
86h | 4 | FF FF FF 7F |
255 255 255 127 | White (Alpha: 127), Pixel (3,1) |
8Ah | 4 | FF 00 00 FF |
255 0 0 255 | Blue (Alpha: 255), Pixel (0,0) |
8Eh | 4 | 00 FF 00 FF |
0 255 0 255 | Green (Alpha: 255), Pixel (1,0) |
92h | 4 | 00 00 FF FF |
0 0 255 255 | Red (Alpha: 255), Pixel (2,0) |
96h | 4 | FF FF FF FF |
255 255 255 255 | White (Alpha: 255), Pixel (3,0) |
Note that the bitmap data starts with the lower left hand corner of the image.
Read more about this topic: BMP File Format, File Structure