Skip to main content

TiffDecoder

Struct TiffDecoder 

Source
pub struct TiffDecoder { /* private fields */ }
Expand description

Decodes a TIFF stream.

Implementations§

Source§

impl TiffDecoder

Source

pub fn new<S>(source: S, limits: Limits) -> Result<TiffDecoder, PixelsError>
where S: Source,

Read and parse a TIFF, decoding its first page.

§Errors

Returns PixelsError::Malformed for a bad header or directory, PixelsError::Unsupported for a layout this codec does not implement, or PixelsError::LimitExceeded if the image exceeds limits.

Source

pub fn with_page<S>( source: S, limits: Limits, page: u32, ) -> Result<TiffDecoder, PixelsError>
where S: Source,

Read and parse a TIFF, decoding page page (0 is the first).

A multi-page TIFF is a chain of image directories, one per page — a stack of scans or faxes. Every page is counted when the file is opened (Decoder::pages), reading only each directory’s size and link, and only the chosen page is parsed and decoded.

§Errors

As TiffDecoder::new, and PixelsError::InvalidArgument if the file has no page page.

Source

pub const fn image(&self) -> &TiffImage

The parsed image description.

Source

pub const fn byte_order(&self) -> ByteOrder

The byte order the file declared.

Trait Implementations§

Source§

impl Debug for TiffDecoder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Decoder for TiffDecoder

Source§

fn exif(&self) -> Option<&[u8]>

The page’s descriptive tags (make, model, date, resolution, orientation, …) and its Exif and GPS directories, laid out as an EXIF block.

Source§

fn xmp(&self) -> Option<&[u8]>

The page’s XMP packet, tag 700.

Source§

fn source_info(&self) -> SourceInfo

Density, compression, bit depth and palette.

Source§

fn descriptor(&self) -> ImageDescriptor

The shape of the image, known after the header is parsed.
Source§

fn pages(&self) -> u32

How many pages the source document holds, at least 1. Read more
Source§

fn orientation(&self) -> Orientation

How the stored image must be turned to display upright, as its metadata declares. Read more
Source§

fn icc_profile(&self) -> Option<&[u8]>

The embedded ICC colour profile, if the file carries one. Read more
Source§

fn capability(&self) -> DecodeCapability

What this decoder can produce without a full decode.
Source§

fn read_row(&mut self, out: &mut [u8]) -> Result<(), PixelsError>

Decode the next row, top to bottom, into out. Read more
Source§

fn read_region( &mut self, region: Region, out: &mut TileMut<'_>, ) -> Result<(), PixelsError>

Decode an arbitrary region into out. Read more
Source§

fn animation(&self) -> Option<Animation>

The source’s animation, if it has more than one frame. Read more
Source§

fn reduced_descriptor(&self, target: (u32, u32)) -> Option<ImageDescriptor>

What this decoder would produce if asked for target or larger, when the format lets it reach that size more cheaply than a full decode. Read more
Source§

fn reduce_to(&mut self, descriptor: ImageDescriptor) -> Result<(), PixelsError>

Commit to producing descriptor, which Decoder::reduced_descriptor must have returned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.