Z Image Format

From ModdingWiki
Jump to navigation Jump to search
Z Image Format
There is no example of an image in this format — upload one!
Format typeImage
HardwareVGA
Colour depth8-bit indexed
Minimum size (pixels)Unknown
Maximum size (pixels)Unknown
PaletteInternal
Plane countUnknown
Transparent pixels?Palette-based
Hitmap pixels?No
Games
Z

Full-screen pictures and other images in Z use IFF .LBM files. The repository viewer supports PBM and ILBM image forms.

File format

The container begins with ASCII FORM, a UINT32BE length, and a four-byte form type (PBM , including its space, or ILBM). Child chunks have a four-byte ID and UINT32BE payload length; odd payload lengths are followed by one alignment byte.

The decoder requires BMHD, CMAP and BODY. Chunk lengths and BMHD words are big-endian.

BMHD fields used by the decoder

Offset Data type Name Description
0 UINT16BE width Image width.
2 UINT16BE height Image height.
8 UINT8 planes Bitplane count.
9 UINT8 mask 0: none; 1: mask plane; 2: transparent palette index.
10 UINT8 compression 0: raw; 1: ByteRun1.
12 UINT16BE transparent Transparent colour for mask mode 2.

BMHD is at least 20 bytes. CMAP contains ordinary 8-bit RGB triplets; it is not a six-bit PAL file.

BODY

PBM stores chunky byte pixels with each row padded to an even byte length. ILBM stores each row as successive bitplanes; each plane row has 2 * ceil(width/16) bytes. Bits are read MSB first, with plane 0 supplying the low colour bit. A mask plane, when present, follows the colour planes.

ByteRun1 control bytes 0–127 copy the next control+1 bytes; 129–255 repeat the following byte 257-control times; 128 does nothing. Decode each stored row to its exact padded length.

Notes

The viewer supports these IFF layouts; this does not imply that every supported variant occurs in the shipped assets.

Source code

From re-z, the open-source browser port:

Credits

This file format was reverse engineered by VorticonCmdr. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)