Struct tiff::encoder::ImageEncoder [−][src]
Expand description
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::*;
use tiff::tags::Tag;
let mut tiff = TiffEncoder::new(&mut file).unwrap();
let mut image = tiff.new_image::<colortype::RGB8>(100, 100).unwrap();
// You can encode tags here
image.encoder().write_tag(Tag::Artist, "Image-tiff").unwrap();
// Strip size can be configured before writing data
image.rows_per_strip(2).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();
You can also call write_data function wich will encode by strip and finish
Implementations
Number of samples the next strip should have.
Write a single strip.
Write strips from data
Set image resolution
Set image resolution unit
Set image x-resolution
Set image y-resolution
Set image number of lines per strip
This function needs to be called before any calls to write_data
or
write_strip
and will return an error otherwise.
Get a reference of the underlying DirectoryEncoder
Write out image and ifd directory.