Flags to force libtiff read/write

This commit is contained in:
wiredfool 2013-11-21 20:33:16 -08:00
parent 65e3bfaf33
commit 16c95fc295

View File

@ -54,6 +54,9 @@ import collections
import itertools
import os
READ_LIBTIFF = False
WRITE_LIBTIFF= False
II = b"II" # little-endian (intel-style)
MM = b"MM" # big-endian (motorola-style)
@ -760,7 +763,7 @@ class TiffImageFile(ImageFile.ImageFile):
offsets = self.tag[STRIPOFFSETS]
h = getscalar(ROWSPERSTRIP, ysize)
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_thunderscan", "tiff_deflate",
"tiff_sgilog", "tiff_sgilog24",
@ -918,7 +921,7 @@ def _save(im, fp, filename):
ifd = ImageFileDirectory(prefix)
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_thunderscan", "tiff_deflate",
"tiff_sgilog", "tiff_sgilog24",