Skip to content

LBM (Image files)

Spike edited this page Dec 20, 2016 · 1 revision

LBM-Files only contain Splash-Screens. Those files contain chunks which means that those files are parted an every part has an other function.

Count Size(Bytes) Information
1 4 "FORM" (File-Identifier)
4 1 Unknown
1 4 "PBM" (Header-Identifier)

after this header different chunk-types follow possibly multiple times:

Count Size(Bytes) Information
1 4 "BHMD" (Chunk-Identifier)
1 4 length (Chunk-Length, round up uneven numbers)
1 2 width (Image width)
1 2 height (Image height
4 1 Unknown
1 2 depth (Color depth)
1 2 compression_flag
length - 20 1 Unknown
Count Size(Bytes) Information
1 4 "CMAP" (Chunk-Identifier)
1 4 length (Chunk-Length, always 768!)
256 3 RGB (Color information)
Count Size(Bytes) Information
1 4 "BODY" (Chunk-Identifier)
1 4 length (Chunk-Length, round up uneven numbers)

Depending on compression_flag the following data are to be distinguished.
compression_flag 0 (uncompressed):

Count Size(Bytes) Information
length 1 color (Colorindex in "CMAP"-palette, alpha is always 0xFF

compression_flag 1 (compressed):
The following three parts are read until either length or width and height of the image are reached.

Count Size(Bytes) Information
1 1 ctype (compression type)

for "ctype" >= 0:

Count Size(Bytes) Information
1 1 count (Number of RGB pixels following)
count 1 color (Colorindex in "CMAP"-palette, alpha is always 0xFF

for "ctype" < 0 (or > 127):

Count Size(Bytes) Information
1 1 color (Colorindex in "CMAP"-palette, alpha is always 0xFF

Number of pixels in byte can be calculated that way: ctype < 0 ? (-ctype + 1) : ctype (Fill x to width, then next line).

Other chunk-types are either not used or unknown, those need to be skipped:

Count Size(Bytes) Information
1 4 "????" (Chunk-Identifier)
1 4 length (Chunk-Length, round up uneven numbers)
length 1 Unkown

Back