Skip to main content

TiffFile

Struct TiffFile 

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

A memory-mapped TIFF file handle.

Implementations§

Source§

impl TiffFile

Source

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Open a TIFF file from disk using memory-mapped I/O.

Source

pub fn open_with_options<P: AsRef<Path>>( path: P, options: OpenOptions, ) -> Result<Self>

Open a TIFF file from disk with explicit decoder options.

Source

pub fn from_bytes(data: Vec<u8>) -> Result<Self>

Open a TIFF file from an owned byte buffer (WASM-compatible).

Source

pub fn from_bytes_with_options( data: Vec<u8>, options: OpenOptions, ) -> Result<Self>

Open a TIFF file from bytes with explicit decoder options.

Source

pub fn from_source(source: SharedSource) -> Result<Self>

Open a TIFF file from an arbitrary random-access source.

Source

pub fn from_source_with_options( source: SharedSource, options: OpenOptions, ) -> Result<Self>

Open a TIFF file from an arbitrary random-access source with options.

Source

pub fn byte_order(&self) -> ByteOrder

Returns the byte order of the TIFF file.

Source

pub fn is_bigtiff(&self) -> bool

Returns true if this is a BigTIFF file.

Source

pub fn ifd_count(&self) -> usize

Returns the number of IFDs (images/pages) in the file.

Source

pub fn ifd(&self, index: usize) -> Result<&Ifd>

Returns the IFD at the given index.

Source

pub fn ifds(&self) -> &[Ifd]

Returns all parsed IFDs.

Source

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

Returns the raw file bytes.

Source

pub fn source(&self) -> &dyn TiffSource

Returns the backing source.

Source

pub fn read_image_bytes(&self, ifd_index: usize) -> Result<Vec<u8>>

Decode an image into native-endian interleaved sample bytes.

Source

pub fn read_window_bytes( &self, ifd_index: usize, row_off: usize, col_off: usize, rows: usize, cols: usize, ) -> Result<Vec<u8>>

Decode a pixel window into native-endian interleaved sample bytes.

Source

pub fn read_window<T: TiffSample>( &self, ifd_index: usize, row_off: usize, col_off: usize, rows: usize, cols: usize, ) -> Result<ArrayD<T>>

Decode a window into a typed ndarray.

Single-band rasters are returned as shape [rows, cols]. Multi-band rasters are returned as shape [rows, cols, samples_per_pixel].

Source

pub fn read_image<T: TiffSample>(&self, ifd_index: usize) -> Result<ArrayD<T>>

Decode an image into a typed ndarray.

Single-band rasters are returned as shape [height, width]. Multi-band rasters are returned as shape [height, width, samples_per_pixel].

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.