lightcraft/crates/codecs/tests
issuenate 88c1e768f1 TIFF: decode 1-, 2- and 4-bit samples
Bilevel scans, CCITT fax images and 2- or 4-bit gray TIFFs were rejected with
"sample buffer too short". The `tiff` crate returns such samples packed, most
significant bits first, eight, four or two to a byte with each row padded to a
whole byte; the converter expects one byte per sample. They are now spread out
one per byte and scaled to 0–255 (255, 85 and 17 times the sample: exact) before
conversion. 3-, 5-, 6- and 7-bit samples, and planar images with more than one
sample narrower than a byte, are refused with an "unsupported" error.

The new test builds 1-bit (both photometric conventions, a width that leaves row
padding, set padding bits), 2-bit and 4-bit strips in code, plus a truncated
strip that must fail cleanly; it fails without the fix with the old error. A
600×400 bilevel image, uncompressed and CCITT G4, now decodes to the same pixels
PIL reads from it.

The module documentation no longer claims palette support: the `tiff` crate
refuses RGBPalette images on every read path, so the palette branch here has
never been reached. The parity row lists palette TIFF as missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 14:47:51 +02:00
..
bench.rs M1.1: codecs fuzz/corpus/bench tests, thumbnail options, README 2026-09-30 12:26:05 -04:00
corpus.rs M1.1: codecs fuzz/corpus/bench tests, thumbnail options, README 2026-09-30 12:26:05 -04:00
fuzz.rs Codecs: bound thumbnail fallback decodes and WebP metadata allocations 2026-10-07 18:49:59 -04:00
roundtrip.rs TIFF: decode 1-, 2- and 4-bit samples 2026-10-08 14:47:51 +02:00