Merge branch 'master' of github.com:Farkal/image-tiff into features/32-bit-float-samples

This commit is contained in:
Etienne Prothon committed 2020-08-04 16:43:01 +02:00
commit 5f48444fa0
11 files changed
+81 -33

No files matched your search

+6
View File
@@ -171,6 +171,12 @@ fn test_decode_data() {
}
}
#[test]
fn issue_69() {
test_image_sum_u16("issue_69_lzw.tiff", ColorType::Gray(16), 1015486);
test_image_sum_u16("issue_69_packbits.tiff", ColorType::Gray(16), 1015486);
}
// TODO: GrayA support
//#[test]
//fn test_gray_alpha_u8()
+7 -3
View File
@@ -1,6 +1,6 @@
extern crate tiff;
use tiff::decoder::{Decoder, DecodingResult};
use tiff::decoder::{Decoder, DecodingResult, ifd};
use tiff::encoder::{colortype, TiffEncoder, SRational};
use tiff::ColorType;
use tiff::tags::Tag;
@@ -24,14 +24,18 @@ fn encode_decode() {
{
let mut tiff = TiffEncoder::new(&mut file).unwrap();
tiff.write_image::<colortype::RGB8>(100, 100, &image_data)
let mut image = tiff.new_image::<colortype::RGB8>(100, 100)
.unwrap();
image.encoder().write_tag(Tag::Artist, "Image-tiff").unwrap();
image.write_data(&image_data).unwrap();
}
{
file.seek(SeekFrom::Start(0)).unwrap();
let mut decoder = Decoder::new(&mut file).unwrap();
assert_eq!(decoder.colortype().unwrap(), ColorType::RGB(8));
assert_eq!(decoder.dimensions().unwrap(), (100, 100));
assert_eq!(decoder.get_tag(Tag::Artist).unwrap(), ifd::Value::Ascii("Image-tiff".into()));
if let DecodingResult::U8(img_res) = decoder.read_image().unwrap() {
assert_eq!(image_data, img_res);
} else {
@@ -281,4 +285,4 @@ fn test_multipage_image() {
// check the dimensions of the image in the second page
assert_eq!(img_decoder.dimensions().unwrap(), (3, 3));
}
}
}
Binary file not shown.
Binary file not shown.