mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Added RGB*;16N Unpackers
This commit is contained in:
parent
c816932f4b
commit
768668c1d7
|
@ -1278,8 +1278,13 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
# we're expecting image byte order. So, if the rawmode
|
||||
# contains I;16, we need to convert from native to image
|
||||
# byte order.
|
||||
if self.mode in ('I;16B', 'I;16') and 'I;16' in rawmode:
|
||||
if rawmode == 'I;16':
|
||||
rawmode = 'I;16N'
|
||||
if '16B' in rawmode:
|
||||
rawmode = rawmode.replace('16B', '16N')
|
||||
if '16L' in rawmode:
|
||||
rawmode = rawmode.replace('16L', '16N')
|
||||
|
||||
|
||||
# Offset in the tile tuple is 0, we go from 0,0 to
|
||||
# w,h, and we only do this once -- eds
|
||||
|
|
|
@ -577,7 +577,7 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
|
||||
self.assertEqual(im.mode, "RGBA")
|
||||
self.assertEqual(im.size, (100, 40))
|
||||
self.assertEqual(im.tile, [('tiff_lzw', (0, 0, 100, 40), 0, ('RGBa;16B', 'tiff_lzw', False))])
|
||||
self.assertEqual(im.tile, [('tiff_lzw', (0, 0, 100, 40), 0, ('RGBa;16N', 'tiff_lzw', False))])
|
||||
im.load()
|
||||
|
||||
self.assert_image_equal_tofile(im, "Tests/images/tiff_16bit_RGBa_target.png")
|
||||
|
|
|
@ -1301,6 +1301,19 @@ static struct {
|
|||
{"RGBA", "B", 8, band2},
|
||||
{"RGBA", "A", 8, band3},
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
{"RGB", "RGB;16N", 64, unpackRGB16B},
|
||||
{"RGBA", "RGBa;16N", 64, unpackRGBa16B},
|
||||
{"RGBA", "RGBA;16N", 64, unpackRGBA16B},
|
||||
{"RGBX", "RGBX;16N", 64, unpackRGBA16B},
|
||||
#else
|
||||
{"RGB", "RGB;16N", 64, unpackRGB16L},
|
||||
{"RGBA", "RGBa;16N", 64, unpackRGBa16L},
|
||||
{"RGBA", "RGBA;16N", 64, unpackRGBA16L},
|
||||
{"RGBX", "RGBX;16N", 64, unpackRGBA16B},
|
||||
#endif
|
||||
|
||||
|
||||
/* true colour w. alpha premultiplied */
|
||||
{"RGBa", "RGBa", 32, copy4},
|
||||
{"RGBa", "BGRa", 32, unpackBGRA},
|
||||
|
|
Loading…
Reference in New Issue
Block a user