Skip to main content

TiffImage

Struct TiffImage 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§descriptor: ImageDescriptor

The engine-facing descriptor.

§bits_per_sample: u32

Bits in each stored sample.

§samples_per_pixel: u32

Channels per stored pixel.

§photometric: Photometric

How samples are interpreted.

§compression: Compression

How pixel data is compressed.

§layout: Layout

Strips or tiles.

§offsets: Vec<u32>

Byte offset of each chunk.

§byte_counts: Vec<u32>

Compressed byte count of each chunk.

§predictor: bool

Whether a horizontal differencing predictor was applied.

§color_map: Vec<u32>

The colour map, for palette images: 3 * 2^bits 16-bit values.

§order: ByteOrder

The byte order the file declared.

§orientation: Orientation

The 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

Source

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.

Source

pub const fn chunks_across(&self) -> u32

The number of chunks (strips or tiles) across the image.

Source

pub const fn chunks_down(&self) -> u32

The number of chunks down the image.

Source

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.

Source

pub const fn chunk_stored_size(&self) -> (u32, u32)

The stored dimensions of chunk (column, row), including any padding.

Source

pub const fn chunk_row_bytes(&self) -> usize

Bytes one stored row of a chunk occupies.

Source

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.

Trait Implementations§

Source§

impl Clone for TiffImage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TiffImage

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.