mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
added generic libtiff en/decoder instead of each compression version
This commit is contained in:
parent
42c17c5947
commit
65e3bfaf33
|
@ -634,7 +634,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
raise IOError("Not exactly one tile")
|
raise IOError("Not exactly one tile")
|
||||||
|
|
||||||
d, e, o, a = self.tile[0]
|
d, e, o, a = self.tile[0]
|
||||||
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
|
d = Image._getdecoder(self.mode, 'libtiff', a, self.decoderconfig)
|
||||||
try:
|
try:
|
||||||
d.setimage(self.im, e)
|
d.setimage(self.im, e)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -1062,7 +1062,7 @@ def _save(im, fp, filename):
|
||||||
|
|
||||||
a = (rawmode, compression, _fp, filename, atts)
|
a = (rawmode, compression, _fp, filename, atts)
|
||||||
# print (im.mode, compression, a, im.encoderconfig)
|
# print (im.mode, compression, a, im.encoderconfig)
|
||||||
e = Image._getencoder(im.mode, compression, a, im.encoderconfig)
|
e = Image._getencoder(im.mode, 'libtiff', a, im.encoderconfig)
|
||||||
e.setimage(im.im, (0,0)+im.size)
|
e.setimage(im.im, (0,0)+im.size)
|
||||||
while 1:
|
while 1:
|
||||||
l, s, d = e.encode(16*1024) # undone, change to self.decodermaxblock
|
l, s, d = e.encode(16*1024) # undone, change to self.decodermaxblock
|
||||||
|
|
|
@ -3316,6 +3316,7 @@ static PyMethodDef functions[] = {
|
||||||
#endif
|
#endif
|
||||||
{"tiff_lzw_decoder", (PyCFunction)PyImaging_TiffLzwDecoderNew, 1},
|
{"tiff_lzw_decoder", (PyCFunction)PyImaging_TiffLzwDecoderNew, 1},
|
||||||
#ifdef HAVE_LIBTIFF
|
#ifdef HAVE_LIBTIFF
|
||||||
|
{"libtiff_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
||||||
{"tiff_ccitt_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
{"tiff_ccitt_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
||||||
{"group3_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
{"group3_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
||||||
{"group4_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
{"group4_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
||||||
|
@ -3327,6 +3328,7 @@ static PyMethodDef functions[] = {
|
||||||
{"tiff_sgilog24_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
{"tiff_sgilog24_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
||||||
{"tiff_raw_16_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
{"tiff_raw_16_decoder", (PyCFunction)PyImaging_LibTiffDecoderNew, 1},
|
||||||
|
|
||||||
|
{"libtiff_encoder", (PyCFunction)PyImaging_LibTiffEncoderNew, 1},
|
||||||
{"tiff_ccitt_encoder", (PyCFunction)PyImaging_LibTiffEncoderNew, 1},
|
{"tiff_ccitt_encoder", (PyCFunction)PyImaging_LibTiffEncoderNew, 1},
|
||||||
{"group3_encoder", (PyCFunction)PyImaging_LibTiffEncoderNew, 1},
|
{"group3_encoder", (PyCFunction)PyImaging_LibTiffEncoderNew, 1},
|
||||||
{"group4_encoder", (PyCFunction)PyImaging_LibTiffEncoderNew, 1},
|
{"group4_encoder", (PyCFunction)PyImaging_LibTiffEncoderNew, 1},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user