Replace decode_image with decode_comprehensive, which exercises per-IFD via a probe_directory helper: - Tag iteration and value parsing for every tag - SubIFD, EXIF, and GPS directory traversal via read_directory - Image metadata (dimensions, colortype, color_map, chunk info) - Layout queries (image_buffer_layout, image_chunk_buffer_layout) - Per-chunk reads at first and last indices - Full image decode via read_image Three IFD traversal strategies: - Linear iteration via next_directory (tolerates invalid intermediate IFDs) - Random-access via seek_to_directory (find_nth_ifd code path) - Image-aware random-access via seek_to_image Dictionary covers classic TIFF and BigTIFF byte order marks, and common IFD tags in both LE and BE (image geometry, strips, tiles, SubIFD, EXIF, GPS, ColorMap). Strict resource limits (512 KB decode/intermediate, 64 KB IFD). Bounded iteration (max 8 linear, max 4 seek).
59 lines
2.9 KiB
Markdown
59 lines
2.9 KiB
Markdown
# image-tiff
|
|
[](https://github.com/image-rs/image-tiff/actions)
|
|
[](https://docs.rs/tiff)
|
|
[](https://crates.io/crates/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](https://github.com/rust-fuzz/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_comprehensive -snone -- -dict=fuzz/tiff.dict -timeout=5`.
|