#[non_exhaustive]pub struct TiffImage {Show 13 fields
pub descriptor: ImageDescriptor,
pub bits_per_sample: u32,
pub samples_per_pixel: u32,
pub photometric: Photometric,
pub compression: Compression,
pub layout: Layout,
pub offsets: Vec<u32>,
pub byte_counts: Vec<u32>,
pub predictor: bool,
pub color_map: Vec<u32>,
pub order: ByteOrder,
pub orientation: Orientation,
pub icc: Option<Vec<u8>>,
}Expand description
Everything about a TIFF image that decoding needs.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.descriptor: ImageDescriptorThe engine-facing descriptor.
bits_per_sample: u32Bits in each stored sample.
samples_per_pixel: u32Channels per stored pixel.
photometric: PhotometricHow samples are interpreted.
compression: CompressionHow pixel data is compressed.
layout: LayoutStrips or tiles.
offsets: Vec<u32>Byte offset of each chunk.
byte_counts: Vec<u32>Compressed byte count of each chunk.
predictor: boolWhether a horizontal differencing predictor was applied.
color_map: Vec<u32>The colour map, for palette images: 3 * 2^bits 16-bit values.
order: ByteOrderThe byte order the file declared.
orientation: OrientationThe Orientation tag; Orientation::Normal when absent or out of
range, which is metadata declined rather than an image refused.
icc: Option<Vec<u8>>The embedded ICC profile, if the directory carries one.
Implementations§
Source§impl TiffImage
impl TiffImage
Sourcepub fn from_directory(
directory: &Directory,
order: ByteOrder,
limits: &Limits,
) -> Result<Self>
pub fn from_directory( directory: &Directory, order: ByteOrder, limits: &Limits, ) -> Result<Self>
Interpret a directory as an image.
§Errors
Returns PixelsError::Malformed for a directory missing tags the
pixels cannot be located without, PixelsError::Unsupported for a
layout this codec does not implement, or PixelsError::LimitExceeded
if the dimensions exceed limits.
Sourcepub const fn chunks_across(&self) -> u32
pub const fn chunks_across(&self) -> u32
The number of chunks (strips or tiles) across the image.
Sourcepub const fn chunks_down(&self) -> u32
pub const fn chunks_down(&self) -> u32
The number of chunks down the image.
Sourcepub fn chunk_region(&self, column: u32, row: u32) -> Region
pub fn chunk_region(&self, column: u32, row: u32) -> Region
The region of the image chunk (column, row) covers.
Tiles are always whole even at the image edge — the specification pads them — so the region is clipped for the caller’s benefit rather than describing what is stored.
Sourcepub const fn chunk_stored_size(&self) -> (u32, u32)
pub const fn chunk_stored_size(&self) -> (u32, u32)
The stored dimensions of chunk (column, row), including any padding.
Sourcepub const fn chunk_row_bytes(&self) -> usize
pub const fn chunk_row_bytes(&self) -> usize
Bytes one stored row of a chunk occupies.
Sourcepub fn read_chunk(&self, data: &[u8], index: usize) -> Result<Vec<u8>>
pub fn read_chunk(&self, data: &[u8], index: usize) -> Result<Vec<u8>>
Decompress chunk index from data, returning stored samples.
§Errors
Returns PixelsError::Malformed if the chunk lies outside the file
or decompresses to something other than its declared size.