Repository navigation
Closed
Description
rdf.zip
github don't eat .tif file, unzip it and
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL.Image
>>> filename="rdf.tif"
>>> img = PIL.Image.open(filename)
>>> img.info
{'resolution': (72.0, 72.0), 'compression': 'tiff_lzw'}
>>> img.size
(518, 556)
>>> img.save("rdf.1.tif", format='TIFF')
Segmentation fault
$ pip show Pillow
---
Name: Pillow
Version: 3.0.0
Location: /usr/local/lib/python2.7/dist-packages
Requires:
$ dpkg -l|grep tiff
ii libtiff-tools 4.0.3-7ubuntu0.3 amd64 TIFF manipulation and conversion tools
ii libtiff4:amd64 3.9.7-2ubuntu1 amd64 Tag Image File Format (TIFF) library (old version)
ii libtiff5:amd64 4.0.3-7ubuntu0.3 amd64 Tag Image File Format (TIFF) library
ii libtiff5:i386 4.0.3-7ubuntu0.3 i386 Tag Image File Format (TIFF) library
ii libtiff5-dev:amd64 4.0.3-7ubuntu0.3 amd64 Tag Image File Format library (TIFF), development files
ii libtiffxx5:amd64 4.0.3-7ubuntu0.3 amd64 Tag Image File Format (TIFF) library -- C++ interface
uname -a
Linux playnet 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=17.2
DISTRIB_CODENAME=rafaela
DISTRIB_DESCRIPTION="Linux Mint 17.2 Rafaela"
And
Linux build64 2.6.32-042stab111.12 #1 SMP Thu Sep 17 11:38:20 MSK 2015 x86_64 x86_64 x86_64 GNU/Linux
$cat /etc/redhat-release
CentOS release 6.7 (Final)
$python -V
Python 2.6.6
Activity
hugovk commentedon Dec 15, 2015
On Windows 7/Python 2.7 I don't see a segmentation fault but get a "Python has stopped working" UI popup and a crash, so probably the same thing.
Pillow 2.9.0 isn't quite as bad:
wiredfool commentedon Dec 15, 2015
It's dying in the metadata, (tag 318: WhitePoint) which is It's the big exif reorg, which is now passing more items into the list of metadata that's being saved by libtiff.
test.py:
playnet commentedon Dec 15, 2015
But "convert" from ImageMagick works absolutely right
playnet commentedon Dec 15, 2015
$ convert -density 204x98 -units PixelsPerInch -resize 1728x1186! -monochrome -compress Fax rdf.tif rdf.resampled.tif
$ ls -la rdf.resampled.tif
-rw-r--r-- 1 playnet playnet 37275 дек. 15 19:46 rdf.resampled.tif
wiredfool commentedon Dec 15, 2015
It looks like things are sane at least to the level of
but then I can't verify that the varargs are correct in the next call.
wiredfool commentedon Dec 15, 2015
So, it looks like this is a 'custom tag' which requires special handling for libtiff to write. Custom being that it's not hardcoded in the list of tags that it handles without specifying the tag/type/etc.
This is going to take work in the guts of the libtiff encoding code.
playnet commentedon Dec 16, 2015
anywhere, segfault is a bug. Possible - (silent) drop these tags...
playnet commentedon Dec 17, 2015
and possible another bug - same pic, convert("1") + resize - crop and corrupt image, but can save it. Tag corrupt body in convert?
wiredfool commentedon Dec 17, 2015
What's the code that causes the last problem. Does it still happen with just the convert?
wiredfool commentedon Dec 17, 2015
Actually, it looks like RGBA is the only destination mode where convert works properly.
wiredfool commentedon Dec 17, 2015
@playnet Try converting any
PAimage to RGBA before doing anything else. And possibly before saving as a tiff as well. I'm thinking that a Palette image just isn't going to work through libtiff at this point.wiredfool commentedon Dec 30, 2015
Can we distribute that image (rdf,tif) as a test image under the Pillow license?
Partial fix for python-pillow#1597
Merge pull request #1620 from wiredfool/issue_1597
radarhere commentedon Dec 22, 2018
Just as a summary - the segfault is resolved by #1620, correctly saving custom tag 318 is likely to be connected to #660, and converting the image is #1600.
hugovk commentedon Dec 22, 2018
Thanks, closing. Can re-open if not covered by those.
radarhere commentedon Dec 26, 2018
So my thinking was that #660 was about int custom tags, and so was resolved by #3350, while #2745 was about string custom tags. I see now that the custom tag in this issue is a tuple.
radarhere commentedon Oct 24, 2025
#9241 means that Pillow 12.0.0 will now save the 318 tag by default, as in the rdf.zip code from the beginning of this issue.