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>
impl<W: Write + Seek> TiffEncoder<W>
Constructor functions to create standard Tiff files.
sourcepub fn new(writer: W) -> TiffResult<TiffEncoder<W, TiffKindStandard>>
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>
impl<W: Write + Seek> TiffEncoder<W, TiffKindBig>
Constructor functions to create BigTiff files.
sourcepub fn new_big(writer: W) -> TiffResult<Self>
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>
impl<W: Write + Seek, K: TiffKind> TiffEncoder<W, K>
Generic functions that are available for both Tiff and BigTiff encoders.
sourcepub fn new_generic(writer: W) -> TiffResult<Self>
pub fn new_generic(writer: W) -> TiffResult<Self>
Creates a new Tiff or BigTiff encoder, inferred from the return type.
sourcepub fn new_directory(&mut self) -> TiffResult<DirectoryEncoder<'_, W, K>>
pub fn new_directory(&mut self) -> TiffResult<DirectoryEncoder<'_, W, K>>
Create a DirectoryEncoder
to encode an ifd directory.
sourcepub fn new_image<C: ColorType>(
&mut self,
width: u32,
height: u32,
) -> TiffResult<ImageEncoder<'_, W, C, K, Uncompressed>>
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.
sourcepub fn new_image_with_compression<C: ColorType, D: Compression>(
&mut self,
width: u32,
height: u32,
compression: D,
) -> TiffResult<ImageEncoder<'_, W, C, K, D>>
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.
sourcepub fn write_image<C: ColorType>(
&mut self,
width: u32,
height: u32,
data: &[C::Inner],
) -> TiffResult<()>
pub fn write_image<C: ColorType>( &mut self, width: u32, height: u32, data: &[C::Inner], ) -> TiffResult<()>
Convenience function to write an entire image from memory.
sourcepub fn write_image_with_compression<C: ColorType, D: Compression>(
&mut self,
width: u32,
height: u32,
compression: D,
data: &[C::Inner],
) -> TiffResult<()>
pub fn write_image_with_compression<C: ColorType, D: Compression>( &mut self, width: u32, height: u32, compression: D, data: &[C::Inner], ) -> TiffResult<()>
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>where
W: RefUnwindSafe,
K: RefUnwindSafe,
impl<W, K> Send for TiffEncoder<W, K>
impl<W, K> Sync for TiffEncoder<W, K>
impl<W, K> Unpin for TiffEncoder<W, K>
impl<W, K> UnwindSafe for TiffEncoder<W, K>where
W: UnwindSafe,
K: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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