Add support for IEEEFP RGB/RGBA/CMYK(32) decoding

This commit is contained in:
Andrew Champion committed 2020-02-10 13:21:13 +00:00
1 parent bbc49291e4
commit 97c888f166
6 files changed
+29 -2

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
[requires]
python_version = "3.7"
+2 -2
View File
@@ -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` | | |
+6
View File
@@ -672,6 +672,12 @@ impl<R: Read + Seek> Decoder<R> {
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)) => {
+10
View File
@@ -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
Binary file not shown.
Binary file not shown.