I have some very simple python code to break a multi-page TIFF into separate pages and save them. If I use compression=None
or compression='raw'
, it works and saves the files. If I try to use any of the other supported compression methods listed in the documentation I get vague errors from libtiff that are 100% unusable:
SystemError: <built-in function libtiff_encoder> returned a result with an error set
I'm not sure how to go about tackling this. Ideally I'd like some way to get more verbose errors or other information about what the error is, but I haven't seen anything in recent pillow documentation about turning on debugging (and that may not even result in better logging from libtiff). Any help or suggestions welcome! (or any fixes!)
I'm using this code:
from PIL import Image, ImageSequence
im = Image.open("multipage.tif")
for i, page in enumerate(ImageSequence.Iterator(im)):
page.save("page%d.tif" % i, compression='xxxxxxx')
from this stackoverflow answer.
Tested on macOS and Debian Squeeze with same results for both operating systems. Libtiff installed and recognized by pillow on both OSes.
As noted in the comments below, neither a single page, nor the complete document will work. A single page of the TIFF file in question is here: .