Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx-b.one.com (mx-b.one.com [91.198.169.49])
	by mail6.local (Postfix) with ESMTP id 5B8F730004DFC3
	for <filtered@awaresystems.be>; Tue,  1 Apr 2014 09:23:25 +0000 (UTC)
X-Virus-Scanned: by one.com
Received-SPF: pass (mx-b: domain of awaresystems.be+caf_=filtered=awaresystems.be@gmail.com designates 209.85.215.53 as permitted sender)
X-Greylist: whitelisted by SQLgrey-1.8.0-rc2
Received: from mail-la0-f53.google.com (mail-la0-f53.google.com [209.85.215.53])
	by mx-b.one.com (Postfix) with ESMTP id 2B4574ACC89
	for <filtered@awaresystems.be>; Tue,  1 Apr 2014 09:23:24 +0000 (UTC)
Received: by mail-la0-f53.google.com with SMTP id b8so6675469lan.40
        for <filtered@awaresystems.be>; Tue, 01 Apr 2014 02:23:24 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-original-authentication-results:delivered-to:delivered-to
         :message-id:date:from:user-agent:mime-version:to:subject:precedence
         :list-id:list-unsubscribe:list-archive:list-post:list-help
         :list-subscribe:content-type:content-transfer-encoding:sender
         :errors-to;
        bh=1JSkAdnbT8VCJdikOplWhD7bJLSsQacrg3g4k9959Bo=;
        b=KlDtcg9ceyACvkkPA3RpmhNAZzMBOfPHj4r60es+0TlqJ3L3CNMufFwAhGf5qqgz5R
         dd0fkMdFbC6JqJuBqrBg8877hBLgm8yiH1fHQh/zYYm1YWey9j0OT2V+7lOuDkRkiIc/
         T/ELJGCRvLPWG4F5300e32gpm1m/RQ+FxbmAccY9lNZ3J9dSH/FbUD22stHl7/k+3nwi
         e6TuLlsXCtHGc3XFJuum9RPxTXAeafjDrU/6JOYwTOPkopWErZO5IaTQE03kwpufLSXV
         ZZILLcCqmydMi/UDSfHFj1vVSNTrXnxkaX+t2nDT8LI265L1Wr6FoQ5/QP7Auak2x24e
         EavA==
X-Original-Authentication-Results: mx.google.com;       spf=neutral (google.com: 91.198.169.50 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mail=tiff-bounces@lists.maptools.org
X-Received: by 10.112.126.7 with SMTP id mu7mr21067300lbb.17.1396344204702;
        Tue, 01 Apr 2014 02:23:24 -0700 (PDT)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.114.11.132 with SMTP id q4csp160873ldb;
        Tue, 1 Apr 2014 02:23:24 -0700 (PDT)
X-Received: by 10.152.197.98 with SMTP id it2mr75761lac.53.1396344202519;
        Tue, 01 Apr 2014 02:23:22 -0700 (PDT)
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 91.198.169.50 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mail=tiff-bounces@lists.maptools.org
Received-SPF: neutral (google.com: 91.198.169.50 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) client-ip=91.198.169.50;
Received: by 10.152.135.244 with POP3 id pv20mf252720lab.38;
        Tue, 01 Apr 2014 02:23:21 -0700 (PDT)
X-Gmail-Fetch-Info: info@awaresystems.be 1 pop.awaresystems.be 110 info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-c.one.com (mx-c.one.com [91.198.169.50])
	by mail6.local (Postfix) with ESMTP id 03CF530004DFC3
	for <info@awaresystems.be>; Tue,  1 Apr 2014 09:17:01 +0000 (UTC)
X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0-rc2
Received: from lists.maptools.org (ks365428.kimsufi.com [94.23.4.142])
	by mx-c.one.com (Postfix) with ESMTP id C429412B184E
	for <info@awaresystems.be>; Tue,  1 Apr 2014 09:17:00 +0000 (UTC)
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 7697035C032;
	Tue,  1 Apr 2014 04:16:14 -0500 (EST)
Received: from mout.gmx.net (mout.gmx.net [212.227.15.15])
	by lists.maptools.org (Postfix) with ESMTPS id 4A1FC35C02F
	for <tiff@lists.maptools.org>; Tue,  1 Apr 2014 04:15:04 -0500 (EST)
Received: from [192.168.1.2] ([109.192.219.19]) by mail.gmx.com (mrgmx003)
	with ESMTPSA (Nemesis) id 0LcBin-1WwaVG1AMn-00jXgc for
	<tiff@lists.maptools.org>; Tue, 01 Apr 2014 11:15:03 +0200
Message-ID: <533A8393.6000308@gmx.de>
Date: Tue, 01 Apr 2014 11:14:59 +0200
From: Johannes Bauer <dfnsonfsduifb@gmx.de>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version: 1.0
To: tiff@lists.maptools.org
X-Enigmail-Version: 1.6
X-Provags-ID: V03:K0:L52bnzCQxHxEw667f2z+C3uW2v6OOmv1TzaGft+7RIuTdTvGHQW
	tgc1jPU9bxl1hAknUERv9Tdwj8fgoIXZjc2rdPrzQoTep0vx8noAJ6FYenqrKYGfgl2GEgy
	LUMWxV5AT1Ac5VjFDB4vcqz/AvBfqmplyrGGkCC6BSdbJCIi9yqo21mpY3R4v0gtWX6fwyi
	uEJXX+WR7fyRAzY7y3ttQ==
Subject: [Tiff] Red background problem when creating colored jpegs resurfaced
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

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
WbqICWkI29J1wzCYLkTWth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32SG7EtOysIbMj0hi1bdMYzefsvG0bhpnLGrsuXCJ6LKl/pWHUecLQhTYwsOeu
vdpqDR5cDMvf/7xaul6bWe1rXOD9Tzfl0vufFOr9zxC6wPvfpfDk2KF9vdpGdZf2
FvcXxiktq29XB/1dONmRpKRz+sC+AltQn1fee+NZinTX9082GEtvU9/E/Ou7T1Aw
FRYP7kl9vybRpd/85uN//kqhl4uFOybmv/3tc0HP+K4kf+eRXyY/PJPa+nnxqZfu
5gee2zF5qjz09ECU2fDJM1FGK5+OMmtPNTMdk83MozuizOu3R0edHv/Xh3/57toz
fyQ/njx1OqV6orjnUOHtkfsfu1wjcXms/P2nXqdX+xrnv//pf4qRXfH7z6BfgLj/
L4VicTvLzdGtDgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAALBKrmIskWRq5Xq1XHKiJd9BebVqsjzBWDKOq29n
nFcLK2st8d5EB1MLED9P5fsSa9gayu+n/JUtZa6O8+q818T5TfS9Ni6fo/IbE2uj
+FbKb4rz2ynf33KewZbzDFG+I1oDNsF2UXmVf4LK76Z8J+WPnGiuEKtae/8P2zsW
0y6mPq9tZme/hWsYRRh7i/Jjuxn78z7VxK9eVUec/PHhCZWyzz69M0pffOGFKF6p
3KzS3wfvXR9tb+odi/YfyUflL85KxLDS8vWfq84Dbr282t0erfJ8nvXfhTSW1n/W
s2r9Z0PqWP/5Uti2JTPt1TLTTuOYto0+WsmvnXCDkA+X/Go9cBsNfsivudyrpeu1
Gd68LTX1R9JE4cPH+bBPUZWP92mXu0kAAAAAAAAAAAAQ+wubxXFPAKAAAA==
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
