Support decoding WebP compressed TIFFs (#336)

Co-authored-by: A. Molzer <5550310+197g@users.noreply.github.com>
This commit is contained in:
Jonathan BehrensandA. Molzer authored and GitHub committed 2026-01-29 10:53:00 -08:00
1 parent 99a7b8cba7
commit a0191ed1a7
8 files changed
+101 -3

No files matched your search

+24 -1
View File
@@ -7,7 +7,7 @@ use tiff::ColorType;
use std::fs::File;
use std::path::PathBuf;
const TEST_IMAGE_DIR: &str = "./tests/images";
const TEST_IMAGE_DIR: &str = "./tests/geotiff";
#[test]
fn test_geo_tiff() {
@@ -61,3 +61,26 @@ fn test_geo_tiff() {
assert_eq!(data.len(), 500);
}
}
#[cfg(feature = "webp")]
#[test]
fn test_webp_tiff() {
let filenames = ["usda_naip_256_webp_z3.tif"];
let mut buffer = DecodingResult::U8(vec![]);
for filename in filenames.iter() {
let path = PathBuf::from(TEST_IMAGE_DIR).join(filename);
let img_file = File::open(path).expect("Cannot find test image!");
let mut decoder = Decoder::new(img_file).expect("Cannot create decoder");
loop {
decoder.read_image_to_buffer(&mut buffer).unwrap();
if !decoder.more_images() {
break;
}
decoder.next_image().unwrap();
}
}
}