From 660b1a98aa788c1ded8c30200117829882c8cddb Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 30 Sep 2013 09:54:34 -0700 Subject: [PATCH 1/2] test for 16bit tiffs, issue #273 --- Tests/test_numpy.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tests/test_numpy.py b/Tests/test_numpy.py index b9cacf0bb..f4f88ff41 100644 --- a/Tests/test_numpy.py +++ b/Tests/test_numpy.py @@ -62,3 +62,12 @@ def test_3d_array(): assert_image(Image.fromarray(a[1, :, :]), "L", (10, 10)) assert_image(Image.fromarray(a[:, 1, :]), "L", (10, 10)) assert_image(Image.fromarray(a[:, :, 1]), "L", (10, 10)) + + +def test_16bit(): + img = Image.open('Tests/images/12bit.cropped.tif') + px = img.load() + np_img = numpy.array(img) + assert_equal(np_img.shape, (64,64)) + assert_equal(px[1,1],np_img[1,1]) + From 753a3266e897134e1711a5dcd35cde511050b9cc Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 30 Sep 2013 09:53:32 -0700 Subject: [PATCH 2/2] resolving shortened url --- Tests/test_numpy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/test_numpy.py b/Tests/test_numpy.py index f4f88ff41..988189391 100644 --- a/Tests/test_numpy.py +++ b/Tests/test_numpy.py @@ -56,7 +56,8 @@ def test_numpy_to_image(): assert_image(to_image(numpy.uint8, 4), "RGBA", (10, 10)) -# based on an erring example at http://is.gd/6F0esS +# based on an erring example at http://is.gd/6F0esS (which resolves to) +# http://stackoverflow.com/questions/10854903/what-is-causing-dimension-dependent-attributeerror-in-pil-fromarray-function def test_3d_array(): a = numpy.ones((10, 10, 10), dtype=numpy.uint8) assert_image(Image.fromarray(a[1, :, :]), "L", (10, 10))