[Image-SIG] Patch: TIFF Group 3/4 decoder support for PIL 1.1.6

Renier Morales Rodríguez renier at morales-rodriguez.net
Wed Jun 27 08:38:50 CEST 2007

Attached is a patch to add TIFF Group 3/4, TIFF CCITT, and TIFF RAW_16
decoding to PIL 1.1.6. The lack of this in PIL is something people have
complained/asked about off and on for years (from looking at mailing
lists and forums on google). However, this is not a new patch. It is
completley based on a patch by Vladimir Pastukhov posted to the
image-sig mailing list in the year of 2003
(http://mail.python.org/pipermail/image-sig/2003-July/002354.html). All
I have done is adapted it so that it applies to PIL 1.1.6. I
tested it against libtiff 3.8.2.

One problem with the patch, and I suppose the reason why it never
catched on, is that it requires libtiff header files that are not
installed as per the current libtiff's installation process. These are
tiffiop.h, tif_dir.h, and tif_config.h. Thus, I am also cc'ing the
libtiff mailing list here. I solve the problem by adding the needed
files to the PIL patch from the libtiff configured source. I assume this
is not a problem license-wise as both libraries are under the BSD. Is
this correct?

I know this is far from ideal. There is a libtiff bug report from the
year 2004 (http://bugzilla.remotesensing.org/show_bug.cgi?id=688)
explaning the need for tiffiop.h and tif_dir.h to be installed
(tiffiop.h didn't use tiff_config.h back then). There is also the
explanation of why they are not installed (they contain private
structures and functions) along with the intention, but without
promises, of creating some separate interface for this kind of access.
I'm adding my vote to that request, but couldn't the header files in
question just be installed in the meantime? Given that there is no
timeline for such special interface and all.

The other problem is that, besides needing other eyes to revise the
patch, I don't know how to test this on Win32 or if more work is
required for that. Would need other interested people to take a shot.

I hope the libtiff developers won't see a problem with adding the
requested headers to the installation for now. It could be made to be
like a deprecated interface by using #warnings or something similar.
Then the problem of breaking applications when an interface to this
finally comes wouldn't be so bad as you could say everyone was warned.
Doing this simple change now, rather than just waiting for a formalized
solution later, would help people improve TIFF support
(multi-page, etc.) in PIL and others.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pil_tiff_group3_4_ccitt.diff
Type: text/x-patch
Size: 42634 bytes
Desc: not available
Url : http://mail.python.org/pipermail/image-sig/attachments/20070627/250dd77a/attachment-0001.bin 

More information about the Image-SIG mailing list