Merge pull request #2748 from wiredfool/i16s

Fix TIFF support for I;16S, I;16BS, and I;32BS rawmodes
This commit is contained in:
wiredfool 2017-09-22 15:57:56 +01:00 committed by GitHub
commit 6198422383
3 changed files with 10 additions and 3 deletions

View File

@ -172,14 +172,14 @@ OPEN_INFO = {
(II, 1, (1,), 1, (16,), ()): ("I;16", "I;16"),
(MM, 1, (1,), 1, (16,), ()): ("I;16B", "I;16B"),
(II, 1, (2,), 1, (16,), ()): ("I;16S", "I;16S"),
(MM, 1, (2,), 1, (16,), ()): ("I;16BS", "I;16BS"),
(II, 1, (2,), 1, (16,), ()): ("I", "I;16S"),
(MM, 1, (2,), 1, (16,), ()): ("I", "I;16BS"),
(II, 0, (3,), 1, (32,), ()): ("F", "F;32F"),
(MM, 0, (3,), 1, (32,), ()): ("F", "F;32BF"),
(II, 1, (1,), 1, (32,), ()): ("I", "I;32N"),
(II, 1, (2,), 1, (32,), ()): ("I", "I;32S"),
(MM, 1, (2,), 1, (32,), ()): ("I;32BS", "I;32BS"),
(MM, 1, (2,), 1, (32,), ()): ("I", "I;32BS"),
(II, 1, (3,), 1, (32,), ()): ("F", "F;32F"),
(MM, 1, (3,), 1, (32,), ()): ("F", "F;32BF"),

BIN
Tests/images/16bit.s.tif Normal file

Binary file not shown.

View File

@ -198,6 +198,13 @@ class TestFileTiff(PillowTestCase):
self.assertEqual(b[0], b'\x01')
self.assertEqual(b[1], b'\xe0')
def test_16bit_s(self):
im = Image.open('Tests/images/16bit.s.tif')
im.load()
self.assertEqual(im.mode, 'I')
self.assertEqual(im.getpixel((0,0)),32767)
self.assertEqual(im.getpixel((0,1)),0)
def test_12bit_rawmode(self):
""" Are we generating the same interpretation
of the image as Imagemagick is? """