Add function to write entire image

This commit is contained in:
Birk Tjelmeland committed 2019-02-09 20:40:25 +01:00
1 parent fb233771b5
commit 503c4d29ed
2 files changed
+14 -9

No files matched your search

+1 -9
View File
@@ -22,15 +22,7 @@ fn encode_decode() {
{
let mut tiff = TiffEncoder::new(&mut file).unwrap();
let mut image = tiff.new_image::<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();
tiff.write_image::<RGB8>(100, 100, &image_data).unwrap();
}
{
file.seek(SeekFrom::Start(0)).unwrap();