Microsoft DirectX 9.0


The BITMAPINFOHEADER structure contains information about the dimensions and color format of a device-independent bitmap (DIB).

Note   This structure is fully described in the Microsoft® Platform SDK. This entry is included in the DirectShow documentation for quick reference.


typedef struct tagBITMAPINFOHEADER {
    DWORD  biSize;
    LONG   biWidth;
    LONG   biHeight;
    WORD   biPlanes;
    WORD   biBitCount;
    DWORD  biCompression;
    DWORD  biSizeImage;
    LONG   biXPelsPerMeter;
    LONG   biYPelsPerMeter;
    DWORD  biClrUsed;
    DWORD  biClrImportant;



Specifies the number of bytes required by the structure.


Specifies the width of the bitmap.

Decoders and video sources should propose formats where biWidth is the width of the image. If the video renderer is using DirectDraw, it modifies the format so that biWidth equals the stride of the surface, and the rcTarget member of the VIDEOINFOHEADER or VIDEOINFOHEADER2 structure specifies the image width. Then it proposes the modified format using IPin::QueryAccept.

For RGB and even-power-of-2 YUV formats, if the video renderer does not specify the stride, then round the width up to the nearst DWORD boundardy to find the stride.


Specifies the height of the bitmap, in pixels.


Specifies the number of planes for the target device. This value must be set to 1.


Specifies the number of bits per pixel. 


If the bitmap is compressed, this member is a FOURCC the specifies the compression. For uncompressed formats, the following values are possible:

Value Description
BI_RGB Uncompressed RGB.
BI_BITFIELDS Uncompressed RGB with color masks. Valid for 16-bpp and 32-bpp bitmaps.

See Remarks for more information.


Specifies the size, in bytes, of the image. This can be set to 0 for uncompressed RGB bitmaps.


Specifies the horizontal resolution, in pixels per meter, of the target device for the bitmap.


Specifies the vertical resolution, in pixels per meter, of the target device for the bitmap.


Specifies the number of color indices in the color table that are actually used by the bitmap.


Specifies the number of color indices that are considered important for displaying the bitmap. If this value is zero, all colors are important.


If the bitmap is 8-bpp or less, the bitmap uses a color table, which immediately follows the BITMAPINFOHEADER. The color table consists of an array of RGBQUAD values. The size of the array is given by the biClrUsed member. If biClrUsed is zero, the array contains the maximum number of colors for the given bitdepth; that is, 2^biBitCount colors.

If biCompression equals BI_BITFIELDS, bitmap uses three DWORD color masks (red, green, and blue, respectively), which specify the byte layout of the pixels. The 1 bits in each mask indicate the bits for that color within the pixel.

For 16-bpp bitmaps, if biCompression equals BI_RGB, the format is RGB 555. If biCompression equals BI_BITFIELDS, the format is either RGB 555 or RGB 565. Use the subtype GUID in the AM_MEDIA_TYPE structure to determine the specific RGB type.

For compressed or YUV types the FOURCC value is specified as a DWORD in little-endian order. For example, YUYV would be 'VYUY' or 0x56595559. For more information, see FOURCC Codes.

In cases where the BITMAPINFOHEADER is followed by a color table or a set of color masks, you can use the BITMAPINFO structure to reference the color table of the color masks. The BITMAPINFO structure is defined as follows:

typedef struct tagBITMAPINFO {
    RGBQUAD          bmiColors[1];

If you cast the BITMAPINFOHEADER to a BITMAPINFO, the bmiHeader member refers to the BITMAPINFOHEADER and the bmiColors member refers to the first entry in the color table, or the first color mask.

Be aware that if the bitmap uses a color table or color masks, then the size of the entire format structure (the BITMAPINFOHEADER plus the color information) is not equal to sizeof(BITMAPINFOHEADER) or sizeof(BITMAPINFO). You must calculate the actual size for each instance.

See Also