The BMHD chunk, the bitmap header, is the one chunk every ILBM must have.
It comes first in the FORM, and it says
how big the picture is, how many bitplanes it has and how the
pixel data is stored. Its data is 20 bytes, a
structure the ILBM document calls BitMapHeader.
Fields
Offsets are from the start of the chunk’s data, after its 8-byte header. All numbers are big-endian.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | UWORD | w | The width in pixels. |
| 2 | 2 | UWORD | h | The height in pixels. |
| 4 | 2 | WORD | x | Where the picture sits on the page, from the left. Usually 0; readers may ignore it. |
| 6 | 2 | WORD | y | Where the picture sits on the page, from the top. Usually 0. |
| 8 | 1 | UBYTE | nPlanes | The number of bitplanes, not counting a mask plane. 1 to 8 for a picture with a colour map, 24 or 32 for a deep one, 0 for a file that holds only a colour map. |
| 9 | 1 | UBYTE | masking | How transparency is given; see Masking. |
| 10 | 1 | UBYTE | compression | How the BODY is packed; see Compression. |
| 11 | 1 | UBYTE | pad1 | Unused: “ignore on read, write as 0”. |
| 12 | 2 | UWORD | transparentColor | The colour number that is transparent, with masking 2 or 3. With other masking it means nothing, but is often set. |
| 14 | 1 | UBYTE | xAspect | The pixel aspect ratio, width part; see Aspect ratio. |
| 15 | 1 | UBYTE | yAspect | The pixel aspect ratio, height part. |
| 16 | 2 | WORD | pageWidth | The width of the page or screen the picture was made on, in pixels. |
| 18 | 2 | WORD | pageHeight | The height of that page. |
The explorer reads exactly 20 bytes. Bytes beyond them in a longer BMHD
are shown as unused and reported. A BMHD shorter than 20 bytes cannot be
read, and the explorer turns the file down as an ILBM.
Masking
| Value | Name | Meaning |
|---|---|---|
| 0 | mskNone | No transparency: the picture is an opaque rectangle. |
| 1 | mskHasMask | A mask plane follows the bitplanes in every row of the BODY; see the mask plane. |
| 2 | mskHasTransparentColor | Every pixel of colour transparentColor is transparent. |
| 3 | mskLasso | The transparent colour is transparent only where it joins the edge of the picture: fill it in from a one-pixel border, as MacPaint’s lasso does. Pixels of that colour enclosed by others stay opaque. |
Masking 0 is the commonest, then 2. Masking 1 is used by some 24-bit brushes. Lasso masking is rare: none was among the files examined for this site. How the explorer applies each one is on the colours page.
Compression
| Value | Name | Meaning |
|---|---|---|
| 0 | cmpNone | The rows are stored as they are. |
| 1 | cmpByteRun1 | Each row is packed with ByteRun1, a run-length encoding. |
| 2 | (no name in the document) | Deluxe Paint ST’s vertical runs: the BODY holds one VDAT chunk for each plane. |
The ILBM document defines only 0 and 1. Value 2 was added by Deluxe Paint for the Atari ST; it is named in later write-ups, and FFmpeg decodes it. Nearly all files use 1. A new value only adds to the format, so files with compression 2 are still ILBM.
Aspect ratio
Pixels on the screens of the time were not square. xAspect and
yAspect say that a pixel is xAspect wide for every
yAspect high. Only the ratio matters, so to compare a file’s ratio with
the one wanted, test
xAspect × yDesiredAspect = yAspect × xDesiredAspect
| Ratio | Where it is used |
|---|---|
| 10:11 | The ILBM document’s value for an Amiga 320 × 200 screen. |
| 1:1 | Square pixels, as on the Macintosh; the document’s other example. |
| 5:6 | 320 × 200 on a PC, written by Deluxe Paint for MS-DOS. |
In the files examined for this site, files from MS-DOS projects had 5:6, and 10:11 and 1:1 were the commonest others; a few had other values, such as 44:52.
Examples
0000000C 42 4D 48 44 00 00 00 14 01 40 00 C8 00 00 00 00
0000001C 08 00 01 00 00 87 05 06 01 40 00 C8
The width is 320 (01 40) and the height 200 (00 C8), at
position 0, 0. There are 8 planes, masking is 0 (none) and compression 1 (ByteRun1).
pad1 is 0. The transparent colour is 135 (00 87), which
means nothing with masking 0. The aspect ratio is 5:6 and the page 320 × 200.