Skip to content

Commit

Permalink
Merge pull request #2748 from wiredfool/i16s
Browse files Browse the repository at this point in the history
Fix TIFF support for I;16S, I;16BS, and I;32BS rawmodes
  • Loading branch information
wiredfool committed Sep 22, 2017
2 parents 2fa09fe + a89c4e4 commit 6198422
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@

(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"),

Expand Down
Binary file added Tests/images/16bit.s.tif
Binary file not shown.
7 changes: 7 additions & 0 deletions Tests/test_file_tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ def test_big_endian(self):
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? """
Expand Down

0 comments on commit 6198422

Please sign in to comment.