The pixels follow the colour map, or
the header and image ID if there is none. There are width × height pixels
of a fixed size. Types 1, 2 and 3 store them in full; types 9, 10 and 11 pack them in
run-length packets.
Pixels
Each row holds width pixels, and the rows come bottom row first unless bit
5 of the descriptor says otherwise. A pixel takes as many whole bytes as its depth
needs:
| Depth | Bytes | True-colour pixel |
|---|---|---|
| 15 | 2 | Bits x R R R R R G G G G G B B B B B, least significant byte first |
| 16 | 2 | The same, with an alpha or overlay bit in the top bit. Programs disagree on what that bit means, and the explorer ignores it. |
| 24 | 3 | Blue, green, red |
| 32 | 4 | Blue, green, red, alpha |
A colour-mapped pixel is a colour number, 8 or 16 bits: it points to the colour map entry of that number, counting from the first entry given in the header. A greyscale pixel of 8 bits is the grey level; at 16 bits it is the grey level followed by 8 bits of alpha.
Alpha counts only when the descriptor says there are alpha bits, and when the extension area, if there is one, agrees. A file written with no alpha bits set leaves the fourth byte of a 32-bit pixel meaningless, and the explorer shows it opaque.
Run-length packets
Types 9, 10 and 11 replace the rows with packets. Each packet starts with a one-byte header:
| Header bit | Name | Meaning |
|---|---|---|
| 7 | type | 1 a run, 0 a raw packet. |
| 6–0 | count | The pixel count minus one: 0 to 127, for 1 to 128 pixels. |
A run packet is followed by one pixel, to be repeated count times; a raw
packet by count pixels as they stand. Pixels are in the layout above.
83 00 00 FF 01 00 FF 00 FF 00 00
Packets and rows
Version 2.0 of the specification says a packet should not hold pixels from more than one row, even when the end of one row matches the start of the next. Version 1 allowed packets to run across rows, and a reader must still accept such files. The explorer reads on across rows and reports a packet that crosses one.