This commit is contained in:
Andrew Murray 2017-09-20 09:00:48 +00:00 committed by GitHub
commit e3d495de46
5 changed files with 8 additions and 1 deletions

BIN
Tests/images/16bit.s.tif Normal file

Binary file not shown.

View File

@ -198,6 +198,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? """

View File

@ -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);

View File

@ -115,7 +115,7 @@ ImagingNewPrologueSubtype(const char *mode, int xsize, int ysize, int size)
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 */

View File

@ -1405,6 +1405,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.