NeXT 2-bit RLE

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name NeXT 2-bit RLE
Ontology

NeXT 2-bit RLE is an image compression scheme that can be used in TIFF files, using TIFF compression code 32766. It uses a pixel-oriented run-length encoding scheme to compress 4-level grayscale images.

It is extremely rare at best, and we have not located much information about it. Everything we know about it comes from libtiff.

Format

The information here is derived from libtiff's decoder, and may be wrong or incomplete.

Each row of the image uses one of three formats, as indicated by the first byte of encoded data corresponding to that row:

Initial byte Encoding scheme Description
0x00 Literal row The row is uncompressed. The uncompressed pixel data starts after the initial 0x00 byte. Four pixels are packed into each byte.
0x40 Literal span The initial byte is followed by two bytes representing a byte offset (as a big-endian integer), and two bytes representing a byte count. Following that are byte count bytes of uncompressed pixel data, which are to be interpreted as beginning at byte offset (assuming four pixels per byte). Any pixels in the row that are not in this range are assigned a gray value of 3 (white).
Any other RLE For each byte (including the initial byte), the two highest bits represent the gray value (from 0 to 3), and the six lowest bits represent the run length (from 0 to 63).

Software

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox