[−][src]Struct tiff::encoder::ImageEncoder
Type to encode images strip by strip.
You should call finish
on this when you are finished with it.
Encoding can silently fail while this is dropping.
Examples
use tiff::encoder::*; let mut tiff = TiffEncoder::new(&mut file).unwrap(); let mut image = tiff.new_image::<colortype::RGB8>(100, 100).unwrap(); let mut idx = 0; while image.next_strip_sample_count() > 0 { let sample_count = image.next_strip_sample_count() as usize; image.write_strip(&image_data[idx..idx+sample_count]).unwrap(); idx += sample_count; } image.finish().unwrap();
Methods
impl<'a, W: 'a + Write + Seek, T: ColorType> ImageEncoder<'a, W, T>
[src]
pub fn next_strip_sample_count(&self) -> u64
[src]
Number of samples the next strip should have.
pub fn write_strip(&mut self, value: &[T::Inner]) -> TiffResult<()> where
[T::Inner]: TiffValue,
[src]
[T::Inner]: TiffValue,
Write a single strip.
pub fn resolution(&mut self, unit: ResolutionUnit, value: Rational)
[src]
Set image resolution
pub fn resolution_unit(&mut self, unit: ResolutionUnit)
[src]
Set image resolution unit
pub fn x_resolution(&mut self, value: Rational)
[src]
Set image x-resolution
pub fn y_resolution(&mut self, value: Rational)
[src]
Set image y-resolution
pub fn encoder(&mut self) -> &mut DirectoryEncoder<'a, W>
[src]
Get a reference of the underlying DirectoryEncoder
pub fn finish(self) -> TiffResult<()>
[src]
Write out image and ifd directory.
Trait Implementations
Auto Trait Implementations
impl<'a, W, C> Unpin for ImageEncoder<'a, W, C> where
C: Unpin,
C: Unpin,
impl<'a, W, C> Sync for ImageEncoder<'a, W, C> where
C: Sync,
W: Sync,
C: Sync,
W: Sync,
impl<'a, W, C> Send for ImageEncoder<'a, W, C> where
C: Send,
W: Send,
C: Send,
W: Send,
impl<'a, W, C> !UnwindSafe for ImageEncoder<'a, W, C>
impl<'a, W, C> RefUnwindSafe for ImageEncoder<'a, W, C> where
C: RefUnwindSafe,
W: RefUnwindSafe,
C: RefUnwindSafe,
W: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,