Struct tiff::encoder::TiffEncoder

source ·
pub struct TiffEncoder<W, K: TiffKind = TiffKindStandard> {
    writer: TiffWriter<W>,
    kind: PhantomData<K>,
}
Expand description

Encoder for Tiff and BigTiff files.

With this type you can get a DirectoryEncoder or a ImageEncoder to encode Tiff/BigTiff ifd directories with images.

See DirectoryEncoder and ImageEncoder.

§Examples

use tiff::encoder::*;

// create a standard Tiff file
let mut tiff = TiffEncoder::new(&mut file).unwrap();
tiff.write_image::<colortype::RGB8>(100, 100, &image_data).unwrap();

// create a BigTiff file
let mut bigtiff = TiffEncoder::new_big(&mut file).unwrap();
bigtiff.write_image::<colortype::RGB8>(100, 100, &image_data).unwrap();

Fields§

§writer: TiffWriter<W>§kind: PhantomData<K>

Implementations§

source§

impl<W: Write + Seek> TiffEncoder<W>

Constructor functions to create standard Tiff files.

source

pub fn new(writer: W) -> TiffResult<TiffEncoder<W, TiffKindStandard>>

Creates a new encoder for standard Tiff files.

To create BigTiff files, use new_big or new_generic.

source§

impl<W: Write + Seek> TiffEncoder<W, TiffKindBig>

Constructor functions to create BigTiff files.

source

pub fn new_big(writer: W) -> TiffResult<Self>

Creates a new encoder for BigTiff files.

To create standard Tiff files, use new or new_generic.

source§

impl<W: Write + Seek, K: TiffKind> TiffEncoder<W, K>

Generic functions that are available for both Tiff and BigTiff encoders.

source

pub fn new_generic(writer: W) -> TiffResult<Self>

Creates a new Tiff or BigTiff encoder, inferred from the return type.

source

pub fn new_directory(&mut self) -> TiffResult<DirectoryEncoder<'_, W, K>>

Create a DirectoryEncoder to encode an ifd directory.

source

pub fn new_image<C: ColorType>( &mut self, width: u32, height: u32, ) -> TiffResult<ImageEncoder<'_, W, C, K, Uncompressed>>

Create an ImageEncoder to encode an image one slice at a time.

source

pub fn new_image_with_compression<C: ColorType, D: Compression>( &mut self, width: u32, height: u32, compression: D, ) -> TiffResult<ImageEncoder<'_, W, C, K, D>>

Create an ImageEncoder to encode an image one slice at a time.

source

pub fn write_image<C: ColorType>( &mut self, width: u32, height: u32, data: &[C::Inner], ) -> TiffResult<()>
where [C::Inner]: TiffValue,

Convenience function to write an entire image from memory.

source

pub fn write_image_with_compression<C: ColorType, D: Compression>( &mut self, width: u32, height: u32, compression: D, data: &[C::Inner], ) -> TiffResult<()>
where [C::Inner]: TiffValue,

Convenience function to write an entire image from memory with a given compression.

Auto Trait Implementations§

§

impl<W, K> Freeze for TiffEncoder<W, K>
where W: Freeze,

§

impl<W, K> RefUnwindSafe for TiffEncoder<W, K>

§

impl<W, K> Send for TiffEncoder<W, K>
where W: Send, K: Send,

§

impl<W, K> Sync for TiffEncoder<W, K>
where W: Sync, K: Sync,

§

impl<W, K> Unpin for TiffEncoder<W, K>
where W: Unpin, K: Unpin,

§

impl<W, K> UnwindSafe for TiffEncoder<W, K>
where W: UnwindSafe, K: 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.