The two newest DIB headers say what the
stored colours mean. BITMAPV4HEADER names a colour space or describes one
with primaries and gamma, and BITMAPV5HEADER adds a rendering intent and an
ICC colour profile. Older headers carry no colour information, and readers treat their
colours as sRGB.
00000046 42 47 52 73
LCS_sRGB as stored: the value 0x73524742, little-endianColour space type
The field bV4CSType (or bV5CSType) at offset 56 of the header
says which colour space applies. Its values are four letters read as a little-endian
number, so sRGB appears in the file as BGRs.
| Value | Name | Meaning |
|---|---|---|
| 0x00000000 (0) | LCS_CALIBRATED_RGB | Use the endpoints and gamma in the header. |
| 0x00000001 (1) | LCS_DEVICE_RGB | Device-dependent RGB. From the original bV4CSType list; later headers dropped it. |
| 0x00000002 (2) | LCS_DEVICE_CMYK | Device-dependent CMYK. From the original bV4CSType list; later headers dropped it. |
| 0x73524742 ('sRGB') | LCS_sRGB | The colours are sRGB. |
| 0x57696E20 ('Win') | LCS_WINDOWS_COLOR_SPACE | The system’s default colour space, sRGB in practice. |
| 0x4C494E4B ('LINK') | PROFILE_LINKED | V5 only: a profile in another file, named in the profile data. |
| 0x4D424544 ('MBED') | PROFILE_EMBEDDED | V5 only: an ICC profile stored in this file. |
Endpoints and gamma
These fields are used only when the type is LCS_CALIBRATED_RGB; otherwise
they are ignored and usually zero. Offsets are from the start of the header.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 60 | 36 | CIEXYZTRIPLE | bV4Endpoints | The CIE XYZ coordinates of the red, green and blue primaries, in that order. Each is three 2.30 fixed point numbers: 2 integer bits and 30 fraction bits. |
| 96 | 4 | u32 | bV4GammaRed | The red tone response, as unsigned 16.16 fixed point. |
| 100 | 4 | u32 | bV4GammaGreen | The green tone response. |
| 104 | 4 | u32 | bV4GammaBlue | The blue tone response. |
In 16.16 fixed point the top 16 bits are the whole number and the bottom 16 the
fraction, so a gamma of 2.2 is stored as 0x00023333.
Rendering intent
bV5Intent, at offset 108 of a V5 header, says how colours outside the
output device’s range should be handled.
| Value | Name | Microsoft’s intent | ICC intent | Meaning |
|---|---|---|---|---|
| 0x01 (1) | LCS_GM_BUSINESS | Graphic | Saturation | Keeps saturation: business charts and other undithered colours. |
| 0x02 (2) | LCS_GM_GRAPHICS | Proof | Relative colorimetric | Keeps a colorimetric match: graphic designs and named colours. |
| 0x04 (4) | LCS_GM_IMAGES | Picture | Perceptual | Keeps contrast: photographs and natural images. |
| 0x08 (8) | LCS_GM_ABS_COLORIMETRIC | Match | Absolute colorimetric | Keeps the white point and matches each colour to the nearest in the destination gamut. |
ICC profile
When the type is PROFILE_EMBEDDED or PROFILE_LINKED, two V5
fields locate the profile data:
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 112 | 4 | u32 | bV5ProfileData | The offset of the profile data, measured from the start of the V5 header, not the start of the file. |
| 116 | 4 | u32 | bV5ProfileSize | The size of the profile data in bytes. |
In a file the header starts at offset 14, so the profile is at
14 + bV5ProfileData. An embedded profile is a complete ICC profile. A linked
profile is a file name, ended by a zero byte, in the Windows-1252 character set; it may
be any fully qualified path, a network path included. Microsoft says the profile data
should follow the bitmap bits, as in the file format, and that applications should read
it only when the header is a V5 header and the type is one of these two.
Readers find the profile only through the offset, so a file can still put it before the
pixels; the explorer reads it wherever it is, and notes when it comes before them. It
reports PROFILE_LINKED or PROFILE_EMBEDDED in a V4 header,
which has no fields to locate a profile.
An ICC profile is its own format (ICC.1,
all numbers big-endian): a 128-byte header with the device class, colour spaces, version,
date and the signature acsp, then a tag table of signature, offset and
size, then each tag’s data. The explorer reads the header fields and the tag table,
names every tag signature ICC.1 registers, and gives the value of the simple tag types:
text and descriptions (the first language of a multi-language text), XYZ numbers,
gamma and parametric curves, dates and signatures. For curves of many points, lookup
tables, named colours, colorant tables and the other compound types it gives only their
size or channel counts, and some types it leaves as bytes.