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

+4
View File
@@ -2,3 +2,7 @@ subsubifd.tif:
url: https://data.kitware.com/api/v1/file/hashsum/sha512/372ca32735c8a8fdbe2286dabead9e779da63f10ba81eda84625e5273f76d74ca1a47a978f67e9c00c12f7f72009c7b2c07a641e643bb0c463812f4ae7f15d6e/download
credit: https://github.com/DigitalSlideArchive/tifftools/commit/4d00c70dbce828262f86c1431f7c66b1748965ac
license: CC0
usda/*.tif
url: https://registry.opendata.aws/naip/index.html
credit: NAIP on AWS was accessed on 2026-01-28 from https://registry.opendata.aws/naip.
license: Public Domain
+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();
}
}
}
File renamed without changes.
Binary file not shown.