You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pillow was refusing to open this TIFF in version 4.2.1. In version 4.3.0, it loads it, but then saving it in any format including TIFF produces a silent corruption. Python 2.7.14 in both cases.
This is the reproducing script:
from PIL import Image
# https://s3-external-1.amazonaws.com/prod-elife-published/articles/32330/elife-32330-fig1-v1.tif
src_fp = 'elife-32330-fig1-v1.tif'
im = Image.open(src_fp)
target_fp = open('result.tif', 'w')
im.save(target_fp)
In 4.2.1:
File "reproducing.py", line 5, in <module>
im = Image.open(src_fp)
File "/opt/loris/venv/local/lib/python2.7/site-packages/PIL/Image.py", line 2519, in open
% (filename if filename else fp))
IOError: cannot identify image file 'elife-32330-fig1-v1.tif'
I tried to track how the Image class changed from 4.2.1 to 4.3.0, but there were too many changes to identify the source. I don't expect it to start to work, but to continue throwing an exception if it can't be read safely.
The text was updated successfully, but these errors were encountered:
giorgiosironi
changed the title
TIFF that could not be loaded gets corrupted by Pillow 4.3.0
TIFF that could not be loaded in 4.2.1 gets silently corrupted in 4.3.0
Nov 7, 2017
If you use libtiff instead of the internal tiff decoder, it works:
from PIL import Image, TiffImagePlugin
TiffImagePlugin.READ_LIBTIFF=True
im = Image.open('issue_2839.tif')
im.show()
This image is a 16bit RGBA image, with tiff_lzw compression. Pillow 4.3.0 added support for the 16 bit RGBA type, though the output image is a lower precision 8 bit per channel RGBA image. Prior to that, there was no support for this image.
Pillow (and PIL before it) have had internal support for tiff_lzw compression, but apparently it's either buggy or cannot handle this particular image mode.
Forcing the TiffImagePlugin to use the libtiff decoder allows Pillow to properly decode this image.
wiredfool
changed the title
TIFF that could not be loaded in 4.2.1 gets silently corrupted in 4.3.0
TIFF_LZW decompression is incorrect for 16bpc image
Nov 11, 2017
Pillow was refusing to open this TIFF in version 4.2.1. In version 4.3.0, it loads it, but then saving it in any format including TIFF produces a silent corruption. Python 2.7.14 in both cases.
This is the reproducing script:
In 4.2.1:
In 4.3.0, no output, file gets stored and corrupted.
elife-32330-fig1-v1.tif.gz
result.tif.gz
I tried to track how the
Image
class changed from 4.2.1 to 4.3.0, but there were too many changes to identify the source. I don't expect it to start to work, but to continue throwing an exception if it can't be read safely.The text was updated successfully, but these errors were encountered: