zentiff [](https://github.com/imazen/zentiff/actions/workflows/ci.yml) [](https://crates.io/crates/zentiff) [](https://lib.rs/crates/zentiff) [](https://docs.rs/zentiff) [](https://github.com/imazen/zentiff#license)

April 9, 2026 · View on GitHub

This repository has been archived. Development continues at imazen/zenextras in the zentiff/ directory.


zentiff CI crates.io lib.rs docs.rs License

TIFF decoding and encoding with zenpixels integration. Wraps the tiff crate, providing a pixel-buffer-oriented API that plugs into the zen* codec ecosystem.

#![forbid(unsafe_code)]

Quick start

use zentiff::{decode, probe, encode, TiffDecodeConfig, TiffEncodeConfig};
use enough::Unstoppable;

// Decode
let data: &[u8] = &[]; // your TIFF bytes
let output = decode(data, &TiffDecodeConfig::default(), &Unstoppable)?;
println!("{}x{}", output.info.width, output.info.height);

// Encode
let encoded = encode(&output.pixels.as_slice(), &TiffEncodeConfig::default(), &Unstoppable)?;
# Ok::<(), whereat::At<zentiff::TiffError>>(())

Decode support

All color types and sample depths handled by the tiff crate:

Source formatOutput
Gray u8/u16Gray8 / Gray16
Gray floatGrayF32
GrayAlpha u8/u16/floatGrayAlpha8/16/F32
RGB / YCbCr / Lab u8/u16/floatRGB8/16/F32
RGBA u8/u16/floatRGBA8/16/F32
PaletteRGB8 (requires _palette feature, see below)
CMYK / CMYKARGBA8/16 (converted)

Higher-depth integers (u32/u64/i8-i64) are widened to the next supported depth. Sub-byte samples (1/2/4/6-bit) are unpacked and scaled to 0-255.

Encode support

FormatDepths
Grayu8, u16, f32
GrayAlphau8, u16, f32 (expanded to RGBA)
RGBu8, u16, f32
RGBAu8, u16, f32

Compression options: LZW (default), Deflate, PackBits, or uncompressed. Horizontal prediction for improved compression ratios. Standard and BigTIFF formats.

Metadata

Extracts ICC profiles, EXIF (re-serialized from sub-IFD), XMP, IPTC, resolution (with cm→inch conversion), orientation, compression method, photometric interpretation, page count, and page name.

zencodec integration

With the zencodec feature, zentiff implements both zencodec::decode::DecoderConfig and zencodec::encode::EncoderConfig for codec-agnostic image pipelines.

Resource limits, cooperative cancellation, and decode policy (metadata suppression) are all supported through the zencodec trait flow.

Features

FeatureDefaultDescription
stdYesStandard library support (required for I/O)
deflateYesDEFLATE/zlib compression
lzwYesLZW compression
zencodecNozencodec encode/decode trait integration
faxNoCCITT fax compression (Group 3/4)
jpegNoJPEG-in-TIFF compression
webpNoWebP-in-TIFF compression
zstdNoZstandard compression
all-codecsNoEnables all compression codecs
_paletteNoPalette TIFF decode (blocked on tiff 0.12, see below)

Known issues

These are upstream limitations in the tiff crate (0.11.x) that affect zentiff:

  • Palette TIFF decode disabled. The tiff crate's color_map() API landed on git main but hasn't been released yet. Palette TIFFs return Unsupported until tiff 0.12 ships. The _palette feature flag exists for forward compatibility but doesn't work with tiff 0.11.x from crates.io.

  • Chroma-subsampled YCbCr not supported. The tiff crate rejects YCbCr data with chroma subsampling (anything other than 1:1) unless JPEG-compressed. There is no upsampling routine in the decoder. This means non-JPEG YCbCr TIFFs with 4:2:2 or 4:2:0 subsampling will fail to decode.

  • Planar TIFF workaround. Decoder::read_image() only reads the first plane for planar TIFFs. zentiff works around this by using read_image_to_buffer() and interleaving planes manually. This workaround is tested and functional.

  • Pending decoder API migration. The upstream tiff crate is moving from Decoder::new() to Decoder::open() + next_image(). zentiff will migrate when tiff 0.12 releases with the new API.

  • Multi-page decode is probe-only. Page count is reported in TiffInfo, but the decode API only reads the first page. Multi-page decode would require exposing page selection (tracked for a future release).

Dependencies

All runtime dependencies are permissive (MIT, Apache-2.0, Zlib, BSD-2-Clause). No copyleft in the dependency tree.

Image tech I maintain

State of the art codecs*zenjpeg · zenpng · zenwebp · zengif · zenavif (rav1d-safe · zenrav1e · zenavif-parse · zenavif-serialize) · zenjxl (jxl-encoder · zenjxl-decoder) · zentiff · zenbitmaps · heic · zenraw · zenpdf · ultrahdr · mozjpeg-rs · webpx
Compressionzenflate · zenzop
Processingzenresize · zenfilters · zenquant · zenblend
Metricszensim · fast-ssim2 · butteraugli · resamplescope-rs · codec-eval · codec-corpus
Pixel types & colorzenpixels · zenpixels-convert · linear-srgb · garb
Pipelinezenpipe · zencodec · zencodecs · zenlayout · zennode
ImageResizerImageResizer (C#) — 24M+ NuGet downloads across all packages
ImageflowImage optimization engine (Rust) — .NET · node · go — 9M+ NuGet downloads across all packages
Imageflow ServerThe fast, safe image server (Rust+C#) — 552K+ NuGet downloads, deployed by Fortune 500s and major brands

* as of 2026

General Rust awesomeness

archmage · magetypes · enough · whereat · zenbench · cargo-copter

And other projects · GitHub @imazen · GitHub @lilith · lib.rs/~lilith · NuGet (over 30 million downloads / 87 packages)

License

Dual-licensed: AGPL-3.0 or commercial.

I've maintained and developed open-source image server software — and the 40+ library ecosystem it depends on — full-time since 2011. Fifteen years of continual maintenance, backwards compatibility, support, and the (very rare) security patch. That kind of stability requires sustainable funding, and dual-licensing is how we make it work without venture capital or rug-pulls. Support sustainable and secure software; swap patch tuesday for patch leap-year.

Our open-source products

Your options:

  • Startup license — $1 if your company has under $1M revenue and fewer than 5 employees. Get a key →
  • Commercial subscription — Governed by the Imazen Site-wide Subscription License v1.1 or later. Apache 2.0-like terms, no source-sharing requirement. Sliding scale by company size. Pricing & 60-day free trial →
  • AGPL v3 — Free and open. Share your source if you distribute.

For commercial licensing details, contact support@imazen.io or visit imazen.io/pricing.

AI-Generated Code Notice

Developed with Claude (Anthropic). Not all code manually reviewed. Review critical paths before production use.