Skip to content

Add TIFF compression codecs: LZMA, Zstd, WebP#3555

Merged
hugovk merged 1 commit intopython-pillow:masterfrom
cgohlke:patch-1
Feb 20, 2019
Merged

Add TIFF compression codecs: LZMA, Zstd, WebP#3555
hugovk merged 1 commit intopython-pillow:masterfrom
cgohlke:patch-1

Conversation

@cgohlke
Copy link
Contributor

@cgohlke cgohlke commented Jan 7, 2019

Windows binaries are linked to a libtiff library, which has LZMA (Python >=3.5), WebP, and ZStd compression codecs enabled. However, Pillow currently fails to open TIFF files that use these compressions.

@radarhere radarhere added the TIFF label Jan 7, 2019
@cgohlke
Copy link
Contributor Author

cgohlke commented Jan 7, 2019

Using this PR, if libtiff wasn't built with extra codec options, Pillow will fail with a different error than the usual OSError: cannot identify image file, e.g.:

tempfile.tif: LZMA compression support is not configured.
tempfile.tif: LZMA compression support is not configured.
tempfile.tif: LZMA compression support is not configured.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "X:\Python27-x64\lib\site-packages\PIL\Image.py", line 2041, in show
    _show(self, title=title, command=command)
  File "X:\Python27-x64\lib\site-packages\PIL\Image.py", line 2906, in _show
    _showxv(image, **options)
  File "X:\Python27-x64\lib\site-packages\PIL\Image.py", line 2911, in _showxv
    ImageShow.show(image, title, **options)
  File "X:\Python27-x64\lib\site-packages\PIL\ImageShow.py", line 53, in show
    if viewer.show(image, title=title, **options):
  File "X:\Python27-x64\lib\site-packages\PIL\ImageShow.py", line 77, in show
    return self.show_image(image, **options)
  File "X:\Python27-x64\lib\site-packages\PIL\ImageShow.py", line 97, in show_image
    return self.show_file(self.save_image(image), **options)
  File "X:\Python27-x64\lib\site-packages\PIL\ImageShow.py", line 93, in save_image
    return image._dump(format=self.get_format(image), **self.options)
  File "X:\Python27-x64\lib\site-packages\PIL\Image.py", line 648, in _dump
    self.load()
  File "X:\Python27-x64\lib\site-packages\PIL\TiffImagePlugin.py", line 1082, in load
    return self._load_libtiff()
  File "X:\Python27-x64\lib\site-packages\PIL\TiffImagePlugin.py", line 1174, in _load_libtiff
    raise IOError(err)
IOError: -2

@hugovk hugovk merged commit 78b7038 into python-pillow:master Feb 20, 2019
radarhere added a commit to radarhere/Pillow that referenced this pull request Mar 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants