BMP file format
Applies to:
BG(2):EE, IWD:EE, PST:EE
General Description
Microsoft format documentationThe Enhanced editions support also version 5 of the BMP format. It is largely the same as version 1 used by the original games, but supports 32-bit colors (still 8 bits per channel, but adds one for alpha).
Header format
| Name | Size | Description | ||
|---|---|---|---|---|
| 0x00 | Signature | 2 bytes | 'BM' | |
| 0x02 | FileSize | 4 bytes | File size in bytes | |
| 0x06 | 2 reserved words | 4 bytes | Unused (=0) | |
| 0x0a | DataOffset | 4 bytes | File offset to Raster Data | |
| 0x0e | Size | 4 bytes | Size of InfoHeader =40 | |
| 0x12 | Width | 4 bytes | Bitmap Width | |
| 0x16 | Height | 4 bytes | Bitmap Height | |
| 0x1a | Planes | 2 bytes | Number of Planes (=1) | |
| 0x1c | BitCount | 2 bytes | Bits per Pixel | |
| 0x1e | Compression | 4 bytes | Type of Compression: BI_RGB (uncompressed), BI_BITFIELDS (uncompressed with color masks), BI_RLE4 / BI_RLE8 (with runtime encoding) | |
| 0x22 | ImageSize | 4 bytes | (compressed) Size of Image It is valid to set this =0 if Compression = 0 |
|
| 0x26 | XpixelsPerM | 4 bytes | Horizontal resolution: Pixels/meter | |
| 0x2a | YpixelsPerM | 4 bytes | Vertical resolution: Pixels/meter | |
| 0x2e | ColorsUsed | 4 bytes | Number of actually used colors | |
| 0x32 | ColorsImportant | 4 bytes | Number of important colors 0 = all |
|
| 0x36 | Color masks | |||
| Red mask | 4 bytes | Mask identifying bits of red component | ||
| Green mask | 4 bytes | Mask identifying bits of green component | ||
| Blue mask | 4 bytes | Mask identifying bits of blue component | ||
| Alpha mask | 4 bytes | Mask identifying bits of alpha component | ||
| 0x46 | CSType | 4 bytes | Color space type | |
| 0x4a | RedX | 4 bytes | X coordinate of red endpoin | |
| 0x4e | RedY | 4 bytes | Y coordinate of red endpoin | |
| 0x52 | RedZ | 4 bytes | Z coordinate of red endpoin | |
| 0x56 | GreenX | 4 bytes | X coordinate of green endpoint | |
| 0x5a | GreenY | 4 bytes | Y coordinate of green endpoint | |
| 0x5e | GreenZ | 4 bytes | Z coordinate of green endpoint | |
| 0x62 | BlueX | 4 bytes | X coordinate of blue endpoint | |
| 0x66 | BlueY | 4 bytes | Y coordinate of blue endpoint | |
| 0x6a | BlueZ | 4 bytes | Z coordinate of blue endpoint | |
| 0x6e | GammaRed | 4 bytes | Gamma red coordinate scale value | |
| 0x72 | GammaGreen | 4 bytes | Gamma green coordinate scale value | |
| 0x76 | GammaBlue | 4 bytes | Gamma blue coordinate scale value | |
| 0x7a | Intent | 4 bytes | Rendering intent for bitmap | |
| 0x7e | ProfileData | 4 bytes | Offset to profile data | |
| 0x82 | ProfileSize | 4 bytes | Size of embedded profile data | |
| 0x86 | Reserved3 | 4 bytes | ||