Expand description
Pure-Rust TIFF 6.0 image decoder + encoder + container.
Implements the Aldus TIFF Revision 6.0 (June 1992) baseline plus the universally-deployed Part 2 extensions (LZW with optional horizontal-differencing predictor; Adobe Deflate; YCbCr / CMYK photometrics; tiles), the multi-IFD chain (multi-page) and the Adobe Pagemaker 6.0 BigTIFF design (8-byte offsets, magic 43). Spec-only clean-room: no external library source was consulted at any point.
Decode-side coverage:
- Byte order:
II(little-endian) andMM(big-endian) - Variants: classic TIFF (32-bit offsets) + BigTIFF (64-bit offsets)
- Photometric: WhiteIsZero / BlackIsZero / RGB / Palette / CMYK / YCbCr / TransparencyMask / CIELab (3-sample Lab* and 1-sample L*-only, TIFF 6.0 §23, decoded to display Rgb24 / Gray8 via Lab → XYZ@D65 → linear NTSC RGB → sRGB)
- Bit depths: 1, 4, 8, 16 (per-strip and per-tile)
- Compression: 1 None / 2 CCITT Modified Huffman / 3 CCITT T.4 1-D /
3 CCITT T.4 2-D (MR) / 4 CCITT T.6 (MMR / Group 4) /
32773 PackBits / 5 LZW / 8 Deflate (zlib) /
7 JPEG-in-TIFF (TIFF Tech Note 2; routes each strip/tile through
oxideav-mjpeg) / 50000 Zstandard (libtiff self-assignment; one zstd frame per strip/tile, identical structural template to Compression=8 — seedocs/image/tiff/tiff-zstd-compression-50000.md) - Predictor: 1 (none) and 2 (horizontal differencing, per-component for SamplesPerPixel > 1)
- Strip OR tile layout
- Multi-page (full next-IFD chain walk via
decode_tiff_all)
Encode-side coverage (classic II / single or multi page):
- Photometric: WhiteIsZero (1-bit bilevel) / BlackIsZero (8/16-bit greyscale) / RGB (8-bit) / Palette (8-bit indexed) / TransparencyMask (1-bit, sets PhotometricInterpretation = 4 and NewSubfileType bit 2 per TIFF 6.0 §“PhotometricInterpretation” value 4 + §“NewSubfileType” bit 2)
- Compression: None / PackBits / LZW / Deflate / CCITT Modified Huffman (Compression=2) / CCITT T.4 1-D (Compression=3, with optional T4Options bit 2 byte-aligned EOLs)
- Layout: single strip,
PlanarConfiguration = 2(separate planes, chunky-source), or tiled (TIFF 6.0 §15, chunky) — seeEncodePage::planar/EncodePage::tiling - Predictor: 2 (horizontal differencing) via
EncodePage::predictor - Multi-page chain via
encode_tiff_multi
Out of scope for this round (next-round backlog): the deprecated
TIFF 6.0 §22 old-style JPEG (Compression=6), encode-side CIELab
(decode-side CIELab is implemented; the EncodePixelFormat enum
has no Lab variant yet), encode-side Compression = 50000
(Zstandard; the TiffCompression enum has no Zstd variant
yet), and Compression = 50001 (WebP — same libtiff
self-assignment as ZSTD; needs its own per-strip-WebP fixture
pass). Decode-side CCITT T.4 2-D and T.6 / Group 4 are implemented
per CCITT Rec. T.4 §4.2 / Rec. T.6 staged at
docs/image/tiff/{T-REC-T.4.pdf,T-REC-T.6.pdf}; decode-side
Compression=7 (new-style JPEG-in-TIFF) is implemented per
TIFF Tech Note 2; decode-side Compression=50000 (Zstandard) is
implemented per docs/image/tiff/tiff-zstd-compression-50000.md.
§Standalone vs registry-integrated
The crate’s default registry Cargo feature pulls in oxideav-core
and exposes the Decoder trait surface, the TIFF container
demuxer/probe, and the registry::register entry point. Disable
the feature (default-features = false) for an oxideav-core-free
build that still exposes the standalone decode_tiff API plus
TiffImage / TiffPixelFormat / TiffPlane / TiffError
types — none of which depend on oxideav-core.
Re-exports§
pub use decoder::decode_tiff;pub use decoder::decode_tiff_all;pub use decoder::DecodedTiff;pub use encoder::encode_tiff;pub use encoder::encode_tiff_multi;pub use encoder::EncodePage;pub use encoder::EncodePixelFormat;pub use encoder::RgbColor;pub use encoder::TiffCompression;pub use error::Result;pub use error::TiffError;pub use image::TiffImage;pub use image::TiffPixelFormat;pub use image::TiffPlane;pub use registry::make_decoder;pub use registry::register;pub use registry::register_codecs;pub use registry::register_containers;
Modules§
- ccitt
- CCITT bilevel decompression for TIFF.
- compress
- Strip decompression for the four compression schemes we support: Compression=1 (None), Compression=32773 (PackBits), Compression=5 (LZW), Compression=8 (Adobe Deflate / zlib).
- container
- TIFF container: a single TIFF file becomes one
Packeton stream0. Width / height / pixel-format are pulled from the first IFD up-front so callers that readStreamInfobefore seeing any frames get accurate metadata. - decoder
- High-level TIFF 6.0 decode: parse the header + first IFD,
decompress every strip, assemble the image, apply the predictor
if any, expand palette / bilevel / 16-bit pixels into one of our
standard
TiffPixelFormats. - encoder
- TIFF 6.0 encoder — single-IFD or multi-page (multi-IFD chain), little-endian on-disk byte order (“II”), classic 32-bit offsets or BigTIFF 64-bit offsets.
- error
- Crate-local error type used by
oxideav-tiff’s standalone (nooxideav-core) public API. - ifd
- TIFF Image File Directory (IFD) parsing.
- image
- Crate-local uncompressed image representation returned by
oxideav-tiff’s standalone (nooxideav-core) decode API. - jpeg
- JPEG-in-TIFF (Compression = 7, per TIFF Technical Note 2) decode helpers.
- registry
oxideav-coreintegration layer foroxideav-tiff.- types
- TIFF 6.0 tag numbers, field-type ids, compression scheme ids, photometric interpretations, and friends. Pure data, no logic.
Constants§
- CODEC_
ID_ STR - Codec id for TIFF image frames.