diff --git a/Tests/images/uint16_2_4660.tif b/Tests/images/uint16_2_4660.tif new file mode 100644 index 000000000..188ff2af7 Binary files /dev/null and b/Tests/images/uint16_2_4660.tif differ diff --git a/Tests/images/uint16_3_4660.tif b/Tests/images/uint16_3_4660.tif new file mode 100644 index 000000000..3c2bc8658 Binary files /dev/null and b/Tests/images/uint16_3_4660.tif differ diff --git a/Tests/images/uint16_4_4660.tif b/Tests/images/uint16_4_4660.tif new file mode 100644 index 000000000..ae8252d78 Binary files /dev/null and b/Tests/images/uint16_4_4660.tif differ diff --git a/Tests/images/uint16_5_4660.tif b/Tests/images/uint16_5_4660.tif new file mode 100644 index 000000000..df92724c3 Binary files /dev/null and b/Tests/images/uint16_5_4660.tif differ diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 8cad25272..39ae7f11d 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -916,3 +916,28 @@ class TestFileTiffW32: # this should not fail, as load should have closed the file pointer, # and close should have closed the mmap os.remove(tmpfile) + + # Created with ImageMagick: convert hopper.jpg hopper_jpg.tif + # Contains JPEGTables (347) tag + infile = "Tests/images/hopper_jpg.tif" + im = Image.open(infile) + + # Act / Assert + # 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()