2014.04.01 09:14 "[Tiff] Red background problem when creating colored jpegs resurfaced", by Johannes Bauer

Hi list,

I have the problem that with the current (4.0.3) version of libtiff and tiff2pdf there appears a red background when trying to create jpeg-compressed PDFs from colored tiff files (grayscale tiffs are fine, zip-compressed PDFs are also fine).

Doing some digging, this bug seems to have appeared as early as 2006, but since been fixed. In any case it resurfaced now. For reference, here's what I think this is:

2006: "tiff2pdf -j (jpeg) alters document color" https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=357291

2007: "Pink pages with tiff2pdf -j" http://www.asmail.be/msg0055293066.html

2008: "tiff2pdf -j displays and prints red in acroread" https://forums.gentoo.org/viewtopic-t-710625-start-0.html

In the 2007 thread, Ed Grissom found the solution (http://www.asmail.be/msg0055262410.html). To quote him:

> I was able to edit the pdf and get it to look right (remove the pink and
> green).
>

> All I had to do was to remove the text "/DecodeParms << /ColorTransform > 0 >>" from just before the JPEG data.

This workaround also works for me.

I've created an example image that demonstrates the problem and a bash script which calls it. It's a base64 tar.gz file (size should be 1627 bytes, MD5 09faa4983e5b3249f26d89ae90a45ef3). I'll attach it to the bottom of this mail as base64 encoded, you can decode it by using

$ openssl base64 -d >redbackground_bug.tar.gz

And then copy and pasting the input. In it you'll find a PNG file (in.png, the original source), a TIFF file (x.tiff, the input for tiff2pdf) and the resulting, red pdf file (x.pdf). Also there's a script "makepdf" which only contains

$ convert -compress None in.png x.tiff
$ tiff2pdf -j -o x.pdf x.tiff

So pretty straightforward.

Hope this is enough information, please don't hesitate to ask if I forgot anything.

Thanks,
Johannes

Attachment: redbackground_bug.tar.gz H4sIAOyAOlMAA+3dW2gcVRgH8LPZNptME2q03tpoT1ujSWl255y57K7UVpPtZamt MQ3YECtOdmfTqdmddXZSoi9W8UF9EgXx8qCgIoj4UBCfRAUFC0oFwSso6oMvCgq+ x+/MTppNtraIaYv4/y2bc+abMzPnNpPZpxO45Wmn9MBM4M/Vyhl2Uegkq+sqFVlr WbqICWkI29J1wzCYLkTWthm3Lk51lptrhE7A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