Struct tiff::decoder::Decoder

source ·
pub struct Decoder<R>
where R: Read + Seek,
{ /* private fields */ }
Expand description

The representation of a TIFF decoder

Currently does not support decoding of interlaced images

Implementations§

source§

impl<R: Read + Seek> Decoder<R>

source

pub fn new(r: R) -> TiffResult<Decoder<R>>

Create a new decoder that decodes from the stream r

source

pub fn with_limits(self, limits: Limits) -> Decoder<R>

source

pub fn dimensions(&mut self) -> TiffResult<(u32, u32)>

source

pub fn colortype(&mut self) -> TiffResult<ColorType>

source

pub fn init(self) -> TiffResult<Decoder<R>>

Initializes the decoder.

source

pub fn next_image(&mut self) -> TiffResult<()>

Reads in the next image. If there is no further image in the TIFF file a format error is returned. To determine whether there are more images call TIFFDecoder::more_images instead.

source

pub fn more_images(&self) -> bool

Returns true if there is at least one more image available.

source

pub fn byte_order(&self) -> ByteOrder

Returns the byte_order

source

pub fn read_ifd_offset(&mut self) -> Result<u64, Error>

source

pub fn read_byte(&mut self) -> Result<u8, Error>

Reads a TIFF byte value

source

pub fn read_short(&mut self) -> Result<u16, Error>

Reads a TIFF short value

source

pub fn read_sshort(&mut self) -> Result<i16, Error>

Reads a TIFF sshort value

source

pub fn read_long(&mut self) -> Result<u32, Error>

Reads a TIFF long value

source

pub fn read_slong(&mut self) -> Result<i32, Error>

Reads a TIFF slong value

source

pub fn read_float(&mut self) -> Result<f32, Error>

Reads a TIFF float value

source

pub fn read_double(&mut self) -> Result<f64, Error>

Reads a TIFF double value

source

pub fn read_long8(&mut self) -> Result<u64, Error>

source

pub fn read_string(&mut self, length: usize) -> TiffResult<String>

Reads a string

source

pub fn read_offset(&mut self) -> TiffResult<[u8; 4]>

Reads a TIFF IFA offset/value field

source

pub fn read_offset_u64(&mut self) -> Result<[u8; 8], Error>

Reads a TIFF IFA offset/value field

source

pub fn goto_offset(&mut self, offset: u32) -> Result<()>

Moves the cursor to the specified offset

source

pub fn goto_offset_u64(&mut self, offset: u64) -> Result<()>

source

pub fn find_tag(&mut self, tag: Tag) -> TiffResult<Option<Value>>

Tries to retrieve a tag. Return Ok(None) if the tag is not present.

source

pub fn find_tag_unsigned<T: TryFrom<u64>>( &mut self, tag: Tag, ) -> TiffResult<Option<T>>

Tries to retrieve a tag and convert it to the desired unsigned type.

source

pub fn find_tag_unsigned_vec<T: TryFrom<u64>>( &mut self, tag: Tag, ) -> TiffResult<Option<Vec<T>>>

Tries to retrieve a vector of all a tag’s values and convert them to the desired unsigned type.

source

pub fn get_tag_unsigned<T: TryFrom<u64>>(&mut self, tag: Tag) -> TiffResult<T>

Tries to retrieve a tag and convert it to the desired unsigned type. Returns an error if the tag is not present.

source

pub fn get_tag(&mut self, tag: Tag) -> TiffResult<Value>

Tries to retrieve a tag. Returns an error if the tag is not present

source

pub fn get_tag_u32(&mut self, tag: Tag) -> TiffResult<u32>

Tries to retrieve a tag and convert it to the desired type.

source

pub fn get_tag_u64(&mut self, tag: Tag) -> TiffResult<u64>

source

pub fn get_tag_f32(&mut self, tag: Tag) -> TiffResult<f32>

Tries to retrieve a tag and convert it to the desired type.

source

pub fn get_tag_f64(&mut self, tag: Tag) -> TiffResult<f64>

Tries to retrieve a tag and convert it to the desired type.

source

pub fn get_tag_u32_vec(&mut self, tag: Tag) -> TiffResult<Vec<u32>>

Tries to retrieve a tag and convert it to the desired type.

source

pub fn get_tag_u16_vec(&mut self, tag: Tag) -> TiffResult<Vec<u16>>

source

pub fn get_tag_u64_vec(&mut self, tag: Tag) -> TiffResult<Vec<u64>>

source

pub fn get_tag_f32_vec(&mut self, tag: Tag) -> TiffResult<Vec<f32>>

Tries to retrieve a tag and convert it to the desired type.

source

pub fn get_tag_f64_vec(&mut self, tag: Tag) -> TiffResult<Vec<f64>>

Tries to retrieve a tag and convert it to the desired type.

source

pub fn get_tag_u8_vec(&mut self, tag: Tag) -> TiffResult<Vec<u8>>

Tries to retrieve a tag and convert it to a 8bit vector.

source

pub fn get_tag_ascii_string(&mut self, tag: Tag) -> TiffResult<String>

Tries to retrieve a tag and convert it to a ascii vector.

source

pub fn strip_count(&mut self) -> TiffResult<u32>

Number of strips in image

source

pub fn read_jpeg(&mut self) -> TiffResult<DecodingResult>

source

pub fn read_strip_to_buffer( &mut self, buffer: DecodingBuffer<'_>, ) -> TiffResult<()>

source

pub fn read_strip(&mut self) -> TiffResult<DecodingResult>

Read a single strip from the image and return it as a Vector

source

pub fn read_image(&mut self) -> TiffResult<DecodingResult>

Decodes the entire image and return it as a Vector

Trait Implementations§

source§

impl<R> Debug for Decoder<R>
where R: Read + Seek + Debug,

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Decoder<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Decoder<R>
where R: RefUnwindSafe,

§

impl<R> Send for Decoder<R>
where R: Send,

§

impl<R> Sync for Decoder<R>
where R: Sync,

§

impl<R> Unpin for Decoder<R>
where R: Unpin,

§

impl<R> UnwindSafe for Decoder<R>
where R: UnwindSafe,

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.
§

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>,

§

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>,

§

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.