From 1c2d46558920e0007deec64a5f6e3f0d6822cd0b Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Mon, 18 Apr 2016 19:56:26 -0700 Subject: [PATCH] Add tests for opening 2-5 layer uint16 greyscale TIFFs. --- Tests/images/uint16_2_4660.tif | Bin 0 -> 558 bytes Tests/images/uint16_3_4660.tif | Bin 0 -> 770 bytes Tests/images/uint16_4_4660.tif | Bin 0 -> 980 bytes Tests/images/uint16_5_4660.tif | Bin 0 -> 1186 bytes Tests/test_file_tiff.py | 13 +++++++++++++ 5 files changed, 13 insertions(+) create mode 100644 Tests/images/uint16_2_4660.tif create mode 100644 Tests/images/uint16_3_4660.tif create mode 100644 Tests/images/uint16_4_4660.tif create mode 100644 Tests/images/uint16_5_4660.tif diff --git a/Tests/images/uint16_2_4660.tif b/Tests/images/uint16_2_4660.tif new file mode 100644 index 0000000000000000000000000000000000000000..188ff2af7b1caf7c0b512fcb76dcbd426a8df8f4 GIT binary patch literal 558 zcmebD)MDUZU|`^3U|?isU<9(bfS3`9%>-mK0mTG>kQpitQpbkG7Gz`r>zxM_7ln$0 s^oT*(AT!0GY9;_R%OL3ug0g{17=nRpkUmDRX$%Y|LZ(8ac<_V)01aF^xc~qF literal 0 HcmV?d00001 diff --git a/Tests/images/uint16_3_4660.tif b/Tests/images/uint16_3_4660.tif new file mode 100644 index 0000000000000000000000000000000000000000..3c2bc86587ef6ce3b1d2a558ba8dd040b221b900 GIT binary patch literal 770 zcmebD)MDUZU|`^3U|?isU<9(bfS3`9%>-mK1I6Y6F*8&gq>c@VEy&0M*1HNQE(#R~ z=@EmnL1v0W)kH8cFvuY34Fa-(LSPUKWP|iAf${|yK#&m(O@vH^%!EeC(GZ|+2mk=6 C?N|i> literal 0 HcmV?d00001 diff --git a/Tests/images/uint16_4_4660.tif b/Tests/images/uint16_4_4660.tif new file mode 100644 index 0000000000000000000000000000000000000000..ae8252d78a721e796e3a16445db3d7c50374873b GIT binary patch literal 980 zcmebD)MDUZU|`^3U|?isU<9(bfS3`9%>-n#0LA73F*8&gq>c@VEy&0M*1H8LE(#R~ z=@EmnL1v0W)hIACFvuY34Fa-(LJZ4*I2gzV>01NDARqvR5FR7Y4iGdEG8HltG8Y=9 MN5f$>9bo1I0ISP&9{>OV literal 0 HcmV?d00001 diff --git a/Tests/images/uint16_5_4660.tif b/Tests/images/uint16_5_4660.tif new file mode 100644 index 0000000000000000000000000000000000000000..df92724c35989846d14183fa9648f2948806528f GIT binary patch literal 1186 zcmebD)MDUZU|`^3U|?isU<9(bfS3`9%>-n#0>$P5F*8&gq>c@VEy&0M*1HQRE(#R~ z=@EmnL1v0W)x2P4V30x58w6yt0OeNzaWIe#(zgMKK|lZwA$*|A;Lt?KRLD%oT*yLb OlrF{<^=!(YLf5( literal 0 HcmV?d00001 diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 84fdd0f49..245959d3a 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -450,6 +450,19 @@ class TestFileTiff(PillowTestCase): # 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()