Skip to main content

Crate zentiff

Crate zentiff 

Source
Expand description

TIFF decoding and encoding with zenpixels integration.

Wraps the tiff crate, providing a pixel-buffer-oriented API that integrates with the zen* codec ecosystem.

§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)?;

§Supported formats

§Decode

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

  • Gray, GrayAlpha, RGB, RGBA in u8/u16/u32/u64/i8/i16/i32/i64/f16/f32/f64
  • Palette (expanded to RGB8)
  • CMYK/CMYKA (converted to RGBA)
  • YCbCr, Lab (decoded as RGB)

§Encode

  • Gray, RGB, RGBA in u8/u16/f32
  • GrayAlpha (expanded to RGBA for encoding)
  • LZW, Deflate, PackBits, or uncompressed
  • Horizontal prediction for improved compression
  • Standard and BigTIFF formats

Modules§

codec
zencodec trait implementations for zentiff.

Structs§

TiffDecodeConfig
Decode configuration for TIFF operations.
TiffDecodeOutput
TIFF decode output.
TiffEncodeConfig
Encode configuration for TIFF operations.
TiffInfo
TIFF image metadata from decoding.

Enums§

Compression
Compression method for TIFF encoding.
Predictor
Predictor for TIFF encoding.
TiffError
Errors from TIFF encode/decode operations.

Functions§

decode
Decode the first frame of a TIFF file to pixels.
encode
Encode a PixelBuffer to TIFF bytes.
encode_into
Encode a PixelSlice to TIFF, appending to the provided output buffer.
probe
Probe TIFF metadata without decoding pixels.

Type Aliases§

Result
Result type alias for zentiff operations.