diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..b723d01 --- /dev/null +++ b/Pipfile @@ -0,0 +1,11 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] + +[requires] +python_version = "3.7" diff --git a/README.md b/README.md index 557401c..d1b8453 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,10 @@ This table lists photometric interpretations and sample formats which are suppor |-|-|-| | `WhiteIsZero` | Gray(8\|16\|32\|64) | Gray(32) | | `BlackIsZero` | Gray(8\|16\|32\|64) | Gray(32) | -| `RGB` | RGB(8\|16\|32\|64), RGBA(8\|16\|32\|64) | | +| `RGB` | RGB(8\|16\|32\|64), RGBA(8\|16\|32\|64) | RGB(32), RGBA(32) | | `RGBPalette` | | | | `Mask` | | | -| `CMYK` | CMYK(8\|16\|32\|64) | | +| `CMYK` | CMYK(8\|16\|32\|64) | CMYK(32) | | `YCbCr` | | | | `CIELab` | | | diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index fd94253..00456bd 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -672,6 +672,12 @@ impl Decoder { reader.read_u32_into(&mut buffer[..bytes / 4])?; bytes / 4 } + (ColorType::RGBA(32), DecodingBuffer::F32(ref mut buffer)) + | (ColorType::RGB(32), DecodingBuffer::F32(ref mut buffer)) + | (ColorType::CMYK(32), DecodingBuffer::F32(ref mut buffer)) => { + reader.read_f32_into(&mut buffer[..bytes / 4])?; + bytes / 4 + } (ColorType::RGBA(64), DecodingBuffer::U64(ref mut buffer)) | (ColorType::RGB(64), DecodingBuffer::U64(ref mut buffer)) | (ColorType::CMYK(64), DecodingBuffer::U64(ref mut buffer)) => { diff --git a/tests/decode_images.rs b/tests/decode_images.rs index 93ea06f..5e05002 100644 --- a/tests/decode_images.rs +++ b/tests/decode_images.rs @@ -58,6 +58,11 @@ fn test_cmyk_u16() { test_image_sum_u16("cmyk-3c-16b.tiff", ColorType::CMYK(16), 2181426827); } +#[test] +fn test_cmyk_f32() { + test_image_sum_f32("cmyk-3c-32b-float.tiff", ColorType::CMYK(32), 496.0405); +} + #[test] fn test_gray_u8() { test_image_sum_u8("minisblack-1c-8b.tiff", ColorType::Gray(8), 2840893); @@ -113,6 +118,11 @@ fn test_rgb_u64() { test_image_sum_u64("gradient-3c-64b.tiff", ColorType::RGB(64), 2030834111716); } +#[test] +fn test_rgb_f32() { + test_image_sum_f32("gradient-3c-32b-float.tiff", ColorType::RGB(32), 472.8405); +} + #[test] fn test_string_tags() { // these files have null-terminated strings for their Software tag. One has extra bytes after diff --git a/tests/images/cmyk-3c-32b-float.tiff b/tests/images/cmyk-3c-32b-float.tiff new file mode 100644 index 0000000..9ad77d8 Binary files /dev/null and b/tests/images/cmyk-3c-32b-float.tiff differ diff --git a/tests/images/gradient-3c-32b-float.tiff b/tests/images/gradient-3c-32b-float.tiff new file mode 100644 index 0000000..de3fa10 Binary files /dev/null and b/tests/images/gradient-3c-32b-float.tiff differ