Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@
(II, 1, (1,), 1, (12,), ()): ("I;16", "I;12"),

(II, 1, (1,), 1, (16,), ()): ("I;16", "I;16"),
(II, 1, (1,), 1, (16,16), (0,)): ("I;16", "I;16"),
(II, 1, (1,), 1, (16,16,16), (0,0,)): ("I;16", "I;16"),
(II, 1, (1,), 1, (16,16,16,16), (0,0,0,)): ("I;16", "I;16"),
(II, 1, (1,), 1, (16,16,16,16,16), (0,0,0,0,)): ("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"),
Expand Down
Binary file added Tests/images/uint16_2_4660.tif
Binary file not shown.
Binary file added Tests/images/uint16_3_4660.tif
Binary file not shown.
Binary file added Tests/images/uint16_4_4660.tif
Binary file not shown.
Binary file added Tests/images/uint16_5_4660.tif
Binary file not shown.
13 changes: 13 additions & 0 deletions Tests/test_file_tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,19 @@ def test_save_tiff_with_jpegtables(self):
# Should not raise UnicodeDecodeError or anything else
im.save(outfile)

def test_open_tiff_uint16_multiband(self):
"""Test opening multiband TIFFs and reading all channels."""
base_value = 4660
for i in range(2, 6):
infile = "Tests/images/uint16_{}_{}.tif".format(i, base_value)
im = Image.open(infile)
im.load()
pixel = [base_value + j for j in range(0, i)]
actual_pixel = im.getpixel((0,0))
if type(actual_pixel) is int:
actual_pixel = [actual_pixel]
self.assertEqual(actual_pixel, pixel)

if __name__ == '__main__':
unittest.main()

Expand Down