Bitmap Header Chunk

The <bmhd-ck> bitmap header chunk is defined as follows:

<bmhd-chunk>  bmhd( struct {
      ULONG   ulMemSize;    /* If ulPelFormat is 'data', only these */
      ULONG   ulPelFormat;  /* four fields are present.              */
      USHORT  wTransType;
      ULONG   ulTransVal;
      ULONG   ulHdrSize;    /* Fields from ulHdrSize forward match  */
      ULONG   ulWidth;      /* the Windows BITMAPINFOHEADER          */
      ULONG   ulHeight;     /* structure, although some fields can   */
      USHORT  ulPlanes;     /* contain new values.                   */
      USHORT  usBitCount;
      ULONG   ulCompression;
      ULONG   ulSizeImage;
      ULONG   ulXPelsPerMeter;
      ULONG   ulYPelsPerMeter;
      ULONG   ulClrUsed;
      ULONG   ulClrImportant;
 } )

If the ulCompression field equals BI_RGB or BI_RLE8 or BI_RLE4, then the extended RDIB has the same bitmap format as a simple RDIB.

Each pixel format defines the orientation or position of the bitmap origin. Windows bitmaps (identified by a value of data in the ulPelFormat field) have the origin at the bottom left. By default, the other formats have their origin at the top left.