0% found this document useful (0 votes)
75 views2 pages

The Color Table

Uploaded by

api-238443394
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views2 pages

The Color Table

Uploaded by

api-238443394
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

The color table (palette) occurs in the BMP image file directly after the BMP file header,

the DIB header (and after optional three red, green and blue bitmasks if the BITMAPINFOHEADER header with BI_BITFIELDS option is used). Therefore, its offset is the size of the BITMAPFILEHEADER plus the size of the DIB header (plus optional 12 bytes for the three bit masks).
Note: On Windows CE the BITMAPINFOHEADER header can be used with the BI_ALPHABITFIELDS[2] option in the biCompression member. In such case, four optional bitmasks follow the BITMAPINFOHEADER header instead of the two bitmask mentioned above, thus the color table's offset is the size of the BITMAPFILEHEADER plus the size of the BITMAPINFOHEADER header plus the 16 bytes of the four bitmasks (red, green, blue and alpha).

The number of entries in the palette is either 2n or a smaller number specified in the header (in the OS/2 BITMAPCOREHEADER header format, only the full-size palette is supported).[1][7] In most cases, each entry in the color table occupies 4 bytes, in the order blue, green, red, 0x00 (see below for exceptions).

The color table is a block of bytes (a table) listing the colors used by the image. Each pixel in an indexed color image is described by a number of bits (1, 4, or 8) which is an index of a single color described by this table. The purpose of the color palette in indexed color bitmaps is to inform the application about the actual color that each of these index values corresponds to. The purpose of the color table in non-indexed (non-palettized) bitmaps is to list the colors used by the bitmap for the purposes of optimization on devices with limited color display capability and to facilitate future conversion to different pixel formats and paletization.

The colors in the color table are usually specified in the 4-byte per entry 8.8.8.0.8 format (in RGBAX notation). The color table used with the OS/2 BITMAPCOREHEADER uses the 3-byte per entry 8.8.8.0.0 format.[1][7] For DIBs loaded in memory, the color table can optionally consist

of 2-byte entries - these entries constitute indexes to the currently realized palette[4] instead of explicit RGB color definitions. Microsoft does not disallow the presence of a valid alpha channel bit mask[8] in BITMAPV4HEADER and BITMAPV5HEADER for 1bpp, 4bpp and 8bpp indexed color images, which indicates that the color table entries can also specify an alpha component using the 8.8.8.[0-8].[0-8] format via the RGBQUAD.rgbReserved[9] member. However, some versions of Microsoft's documentation disallow this feature by stating that the RGBQUAD.rgbReserved member "must be zero".

As mentioned above, the color table is normally not used when the pixels are in the 16-bit per pixel (16bpp) format (and higher); there are normally no color table entries in those bitmap image files. However, the Microsoft documentation (on the MSDN web site as of Nov. 16, 2010[10]) specifies that for 16bpp (and higher), the color table can be present to store a list of colors intended for optimization on devices with limited color display capability, while it also specifies, that in such cases, no indexed palette entries are present in this Color Table. This may seem like a contradiction if no distinction is made between the mandatory palette entries and the optional color list.

http://en.wikipedia.org/wiki/BMP_file_format

You might also like