Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bits value for RGB;16N unpackers #3837

Merged
merged 1 commit into from May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added Tests/images/tiff_16bit_RGB.tiff
Binary file not shown.
Binary file added Tests/images/tiff_16bit_RGB_target.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions Tests/test_file_libtiff.py
Expand Up @@ -631,6 +631,21 @@ def test_save_tiff_with_jpegtables(self):
# Should not raise UnicodeDecodeError or anything else
im.save(outfile)

def test_16bit_RGB_tiff(self):
im = Image.open("Tests/images/tiff_16bit_RGB.tiff")

self.assertEqual(im.mode, "RGB")
self.assertEqual(im.size, (100, 40))
self.assertEqual(
im.tile,
[('tiff_adobe_deflate', (0, 0, 100, 40), 0,
('RGB;16N', 'tiff_adobe_deflate', False))]
)
im.load()

self.assert_image_equal_tofile(
im, "Tests/images/tiff_16bit_RGB_target.png")

def test_16bit_RGBa_tiff(self):
im = Image.open("Tests/images/tiff_16bit_RGBa.tiff")

Expand Down
4 changes: 2 additions & 2 deletions src/libImaging/Unpack.c
Expand Up @@ -1369,12 +1369,12 @@ static struct {
{"RGBA", "A", 8, band3},

#ifdef WORDS_BIGENDIAN
{"RGB", "RGB;16N", 64, unpackRGB16B},
{"RGB", "RGB;16N", 48, unpackRGB16B},
{"RGBA", "RGBa;16N", 64, unpackRGBa16B},
{"RGBA", "RGBA;16N", 64, unpackRGBA16B},
{"RGBX", "RGBX;16N", 64, unpackRGBA16B},
#else
{"RGB", "RGB;16N", 64, unpackRGB16L},
{"RGB", "RGB;16N", 48, unpackRGB16L},
{"RGBA", "RGBa;16N", 64, unpackRGBa16L},
{"RGBA", "RGBA;16N", 64, unpackRGBA16L},
{"RGBX", "RGBX;16N", 64, unpackRGBA16B},
Expand Down