Add 19 new libtiff-generated test images and a reference decoder (verify_seq_tiff.c) that independently verifies all checksums using libtiff's own read path, giving three-way agreement: libtiff writer → libtiff reader → image-tiff reader New coverage: - Standard sub-byte: 1-bit, 2-bit, 4-bit grayscale (BIZ + WIZ) - Multi-strip: RowsPerStrip=4 (gray 8/16, RGB 8) - Tiled + compressed: LZW and Deflate tiles - Float predictor: f32/f64 + Deflate + predictor=3 - Unassociated alpha: RGBA 8-bit with EXTRASAMPLE_UNASSALPHA - Sub-byte RGB: 5-bit and 7-bit contiguous - Signed RGB: i8 and i16 (3-channel, decoded as Multiband) - Float f64 RGB - Tiled BigTIFF verify_seq_tiff.c: reads each TIFF with libtiff, computes matching checksums (handling packed sub-byte, unpacked extended, float, signed), and verifies 68/68 cases pass. Total: 74 test images (66.8 KB), 317 tests all passing.
image-tiff
TIFF decoding and encoding library in pure Rust
Supported
Features
- Baseline spec (other than formats and tags listed below as not supported)
- Multipage
- BigTIFF
- Incremental decoding
Formats
This table lists photometric interpretations and sample formats which are supported for encoding and decoding. The entries are ColorType variants for which sample bit depths are supported. Only samples where all bit depths are equal are currently supported. For example, RGB(8) means that the bit depth [8, 8, 8] is supported and will be interpreted as an 8 bit per channel RGB color type.
PhotometricInterpretation |
UINT Format | IEEEFP Format |
|---|---|---|
WhiteIsZero |
Gray(8|16|32|64) | Gray(32|64) |
BlackIsZero |
Gray(8|16|32|64) | Gray(32|64) |
RGB |
RGB(8|16|32|64), RGBA(8|16|32|64) | RGB(32|64), RGBA(32|64) |
RGBPalette |
||
Mask |
||
CMYK |
CMYK(8|16|32|64) | CMYK(32|64) |
CMYKA |
CMYKA(8) | |
YCbCr |
||
CIELab |
Compressions
| Decoding | Encoding | |
|---|---|---|
| None | ✓ | ✓ |
| LZW | ✓ | ✓ |
| Deflate | ✓ | ✓ |
| PackBits | ✓ | ✓ |
| Fax4 | ✓ | not yet |
| JPEG | ✓ | not yet |
| ZSTD | ✓ | not yet |
Not yet supported
Formats and interpretations not listed above or with empty entries are unsupported.
- Baseline tags
ExtraSamples
- Extension tags
Fuzzing
This crate uses cargo-fuzz in order to test the image parser.
After installing it with cargo install cargo-fuzz on a nightly rustc, the
fuzzing harness can be run with recommended settings using
cargo fuzz run decode_image -snone -- -timeout=5.