mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-03 19:33:07 +03:00
Flags to force libtiff read/write
This commit is contained in:
parent
65e3bfaf33
commit
16c95fc295
|
@ -54,6 +54,9 @@ import collections
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
READ_LIBTIFF = False
|
||||||
|
WRITE_LIBTIFF= False
|
||||||
|
|
||||||
II = b"II" # little-endian (intel-style)
|
II = b"II" # little-endian (intel-style)
|
||||||
MM = b"MM" # big-endian (motorola-style)
|
MM = b"MM" # big-endian (motorola-style)
|
||||||
|
|
||||||
|
@ -760,7 +763,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
offsets = self.tag[STRIPOFFSETS]
|
offsets = self.tag[STRIPOFFSETS]
|
||||||
h = getscalar(ROWSPERSTRIP, ysize)
|
h = getscalar(ROWSPERSTRIP, ysize)
|
||||||
w = self.size[0]
|
w = self.size[0]
|
||||||
if self._compression in ["tiff_ccitt", "group3", "group4",
|
if READ_LIBTIFF or self._compression in ["tiff_ccitt", "group3", "group4",
|
||||||
"tiff_jpeg", "tiff_adobe_deflate",
|
"tiff_jpeg", "tiff_adobe_deflate",
|
||||||
"tiff_thunderscan", "tiff_deflate",
|
"tiff_thunderscan", "tiff_deflate",
|
||||||
"tiff_sgilog", "tiff_sgilog24",
|
"tiff_sgilog", "tiff_sgilog24",
|
||||||
|
@ -918,7 +921,7 @@ def _save(im, fp, filename):
|
||||||
ifd = ImageFileDirectory(prefix)
|
ifd = ImageFileDirectory(prefix)
|
||||||
|
|
||||||
compression = im.encoderinfo.get('compression',im.info.get('compression','raw'))
|
compression = im.encoderinfo.get('compression',im.info.get('compression','raw'))
|
||||||
libtiff = compression in ["tiff_ccitt", "group3", "group4",
|
libtiff = WRITE_LIBTIFF or compression in ["tiff_ccitt", "group3", "group4",
|
||||||
"tiff_jpeg", "tiff_adobe_deflate",
|
"tiff_jpeg", "tiff_adobe_deflate",
|
||||||
"tiff_thunderscan", "tiff_deflate",
|
"tiff_thunderscan", "tiff_deflate",
|
||||||
"tiff_sgilog", "tiff_sgilog24",
|
"tiff_sgilog", "tiff_sgilog24",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user