2007.06.27 06:55 "[Tiff] Fw: Patch: TIFF Group 3/4 decoder support for PIL 1.1.6", by Renier Morales Rodríguez

2007.06.27 06:55 "[Tiff] Fw: Patch: TIFF Group 3/4 decoder support for PIL 1.1.6", by Renier Morales Rodríguez

Resending. First email was over 40KB because of attachment and got held up. Attachment can be found here: http://www.pastebin.ca/591452

Begin forwarded message:

Date: Wed, 27 Jun 2007 02:38:50 -0400 From: Renier Morales Rodríguez <renier@morales-rodriguez.net> To: image-sig@python.org, tiff@lists.maptools.org Subject: Patch: TIFF Group 3/4 decoder support for PIL 1.1.6

Hello,

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.

Thoughts?

        --Renier