pub struct TiffEncoder { /* private fields */ }Expand description
Encoder for baseline TIFF images.
Writes chunky (PlanarConfiguration = 1) strips, optionally PackBits-compressed
(Self::with_compression). Supports 8-bit grayscale/RGB and 1-bit bilevel; richer colour
modes and compression schemes are added in later phases. Emits classic TIFF by default, or
BigTIFF (64-bit offsets) when Self::with_big_tiff is set.
Implementations§
Source§impl TiffEncoder
impl TiffEncoder
Sourcepub fn with_byte_order(self, order: ByteOrder) -> Self
pub fn with_byte_order(self, order: ByteOrder) -> Self
Returns a copy of this encoder that writes in the given byte order.
Sourcepub fn with_compression(self, compression: Compression) -> Self
pub fn with_compression(self, compression: Compression) -> Self
Returns a copy of this encoder that compresses image data with compression.
Sourcepub fn with_predictor(self, predictor: Predictor) -> Self
pub fn with_predictor(self, predictor: Predictor) -> Self
Returns a copy of this encoder that applies predictor before compression.
Predictor::HorizontalDifferencing requires 8-bit samples and pairs well with LZW.
Sourcepub fn with_tiling(self, tile_width: u32, tile_height: u32) -> Self
pub fn with_tiling(self, tile_width: u32, tile_height: u32) -> Self
Returns a copy of this encoder that writes the image as tiles of tile_width × tile_height
pixels instead of strips.
Both dimensions must be positive multiples of 16. Tiling is currently supported for 8-bit
images compressed with None/PackBits/LZW (no predictor).
Sourcepub fn with_big_tiff(self, big_tiff: bool) -> Self
pub fn with_big_tiff(self, big_tiff: bool) -> Self
Returns a copy of this encoder that writes BigTIFF (magic 43, 64-bit offsets) instead of
classic TIFF.
BigTIFF only widens the container’s structural fields; every colour mode, compression scheme, strip/tile layout, and multi-page feature applies unchanged, so this composes with the other builders. Its 64-bit offsets let a file exceed the 4 GiB classic limit. A reader detects the variant from the header magic, so no decoder flag is needed. Defaults to off.
Sourcepub fn encode_palette8(
&self,
indices: ImageRef<'_, Indexed8>,
palette: &Palette8,
out: &mut Vec<u8>,
) -> Result<usize>
pub fn encode_palette8( &self, indices: ImageRef<'_, Indexed8>, palette: &Palette8, out: &mut Vec<u8>, ) -> Result<usize>
Encodes an 8-bit palette-colour image: one Indexed8 sample per pixel selecting an entry
of palette.
indices is the width * height index buffer (already validated by ImageRef); palette
is the 256-entry colour table. Returns the number of bytes written. Palette colour does not
fit the single-buffer EncodeImage shape (it needs the separate colour table), so it stays
an inherent method.
Sourcepub fn encode_pages_rgb8(
&self,
pages: &[ImageRef<'_, Rgb8>],
out: &mut Vec<u8>,
) -> Result<usize>
pub fn encode_pages_rgb8( &self, pages: &[ImageRef<'_, Rgb8>], out: &mut Vec<u8>, ) -> Result<usize>
Encodes several 8-bit Rgb8 images as the pages of one multi-page TIFF.
Each page is a validated ImageRef. Returns the number of bytes written.
§Errors
Returns Error::InvalidInput if pages is empty.
Trait Implementations§
Source§impl Clone for TiffEncoder
impl Clone for TiffEncoder
Source§fn clone(&self) -> TiffEncoder
fn clone(&self) -> TiffEncoder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more