Struct tiff::encoder::TiffEncoder
source · pub struct TiffEncoder<W, K: TiffKind = TiffKindStandard> { /* private fields */ }
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();
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.