diff --git a/Tests/images/tiff_strip_cmyk_16l_jpeg.tif b/Tests/images/tiff_strip_cmyk_16l_jpeg.tif new file mode 100644 index 00000000000..8bfd8bd6a89 Binary files /dev/null and b/Tests/images/tiff_strip_cmyk_16l_jpeg.tif differ diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py index 0292b7733f1..1d30393d4df 100644 --- a/Tests/test_file_libtiff.py +++ b/Tests/test_file_libtiff.py @@ -687,6 +687,12 @@ def test_strip_cmyk_jpeg(self): self.assert_image_similar_tofile(im, "Tests/images/pil_sample_cmyk.jpg", 0.5) + def test_strip_cmyk_16l_jpeg(self): + infile = "Tests/images/tiff_strip_cmyk_16l_jpeg.tif" + im = Image.open(infile) + + self.assert_image_similar_tofile(im, "Tests/images/pil_sample_cmyk.jpg", 0.5) + def test_strip_ycbcr_jpeg_2x2_sampling(self): infile = "Tests/images/tiff_strip_ycbcr_jpeg_2x2_sampling.tif" im = Image.open(infile) diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index 44dde19956c..0056dc7f5da 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -263,6 +263,8 @@ (II, 5, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0)): ("CMYK", "CMYKXX"), (MM, 5, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0)): ("CMYK", "CMYKXX"), + (II, 5, (1,), 1, (16, 16, 16, 16), ()): ("CMYK", "CMYK;16L"), + # JPEG compressed images handled by LibTiff and auto-converted to RGBX # Minimal Baseline TIFF requires YCbCr images to have 3 SamplesPerPixel (II, 6, (1,), 1, (8, 8, 8), ()): ("RGB", "RGBX"), diff --git a/src/libImaging/Unpack.c b/src/libImaging/Unpack.c index 2e29b20f417..d9a948b3246 100644 --- a/src/libImaging/Unpack.c +++ b/src/libImaging/Unpack.c @@ -1417,6 +1417,7 @@ static struct { {"CMYK", "CMYKXX", 48, copy4skip2}, {"CMYK", "CMYK;I", 32, unpackCMYKI}, {"CMYK", "CMYK;L", 32, unpackRGBAL}, + {"CMYK", "CMYK;16L", 64, unpackRGBA16L}, {"CMYK", "C", 8, band0}, {"CMYK", "M", 8, band1}, {"CMYK", "Y", 8, band2},