From 5a94af619570ccbbfa76fad4b150356fa9f23814 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 23 Aug 2015 13:06:12 +1000 Subject: [PATCH 1/3] Added S to list of I;16 formats --- libImaging/Storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libImaging/Storage.c b/libImaging/Storage.c index fb27572d3..2ca1162eb 100644 --- a/libImaging/Storage.c +++ b/libImaging/Storage.c @@ -116,7 +116,7 @@ ImagingNewPrologueSubtype(const char *mode, int xsize, int ysize, im->linesize = xsize * 4; im->type = IMAGING_TYPE_INT32; - } else if (strcmp(mode, "I;16") == 0 || strcmp(mode, "I;16L") == 0 \ + } else if (strcmp(mode, "I;16") == 0 || strcmp(mode, "I;16L") == 0 || strcmp(mode, "I;16S") == 0 \ || strcmp(mode, "I;16B") == 0 || strcmp(mode, "I;16N") == 0) { /* EXPERIMENTAL */ /* 16-bit raw integer images */ From 90c4337a2303078a91ad12db40d428a9c024cf60 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 19 Sep 2015 10:12:00 +1000 Subject: [PATCH 2/3] Added test image --- Tests/images/16bit.s.tif | Bin 0 -> 334 bytes Tests/test_file_tiff.py | 5 +++++ 2 files changed, 5 insertions(+) create mode 100644 Tests/images/16bit.s.tif diff --git a/Tests/images/16bit.s.tif b/Tests/images/16bit.s.tif new file mode 100644 index 0000000000000000000000000000000000000000..f36e68d610b3787efaa0778b4f7d07538a7094f6 GIT binary patch literal 334 zcmebD)MB{6z`*do9!Ow-p(o14z`)4NzzFmSkj21=#AbrB1%TqrP&P;%8xmWPkp--m a11K(vBrXmWKLHe%K@ty!vYCM5AOHZ4HWFz7 literal 0 HcmV?d00001 diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index cf00551ba..79ba17ba6 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -188,6 +188,11 @@ class TestFileTiff(PillowTestCase): 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;16S') + def test_12bit_rawmode(self): """ Are we generating the same interpretation of the image as Imagemagick is? """ From 37323445712c297ed0f5e5c1d20374d58638f6e3 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 19 Sep 2015 12:09:10 +1000 Subject: [PATCH 3/3] Added access and storage entries --- libImaging/Access.c | 1 + libImaging/Unpack.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libImaging/Access.c b/libImaging/Access.c index 059f2aaeb..d0e9cf6f5 100644 --- a/libImaging/Access.c +++ b/libImaging/Access.c @@ -227,6 +227,7 @@ ImagingAccessInit() ADD("I;16", line_16, get_pixel_16L, put_pixel_16L); ADD("I;16L", line_16, get_pixel_16L, put_pixel_16L); ADD("I;16B", line_16, get_pixel_16B, put_pixel_16B); + ADD("I;16S", line_16, get_pixel_16L, put_pixel_16L); ADD("I;32L", line_32, get_pixel_32L, put_pixel_32L); ADD("I;32B", line_32, get_pixel_32B, put_pixel_32B); ADD("F", line_32, get_pixel_32, put_pixel_32); diff --git a/libImaging/Unpack.c b/libImaging/Unpack.c index dfc8a4d7e..2f1108308 100644 --- a/libImaging/Unpack.c +++ b/libImaging/Unpack.c @@ -1348,6 +1348,7 @@ static struct { /* storage modes */ {"I;16", "I;16", 16, copy2}, {"I;16B", "I;16B", 16, copy2}, + {"I;16S", "I;16S", 16, copy2}, {"I;16L", "I;16L", 16, copy2}, {"I;16", "I;16N", 16, unpackI16N_I16}, // LibTiff native->image endian.