il_tiff.c::iSaveTiffInternal() is hard coded to use LZW compression when the IL_USE_COMPRESSION hint is set. However, if LZW compression is not enabled in the linked version of libtiff then the subsequent call to TIFFWriteScanline() will fail with an error relating to LZW not being found, and a valid TIFF will not be created.
Coincidentally, I discovered this issue while working in Windows with the pre-compiled external libraries provided here: http://downloads.sourceforge.net/openil/LibCompiled-vc9.zip. This means that anyone using the pre-compiled libraries would be unable to successfully write compressed TIFFs. I'd suggest that the next time this package is updated that libtiff get built with LZW support.
In the mean time, and for the sake of robustness, I've updated the code in iSaveTiffInternal() to choose between any of three lossless compression codecs, and if none are found then to revert to no compression. Please see the attached patch file.
Log in to post a comment.