Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-s.b-one.net (mx-s.one.com [91.198.169.250])
	by mail9.b-one.net (Postfix) with ESMTP id DE351400505
	for <info@awaresystems.be>; Mon, 21 Mar 2011 20:30:11 +0100 (CET)
Received: by mx-s.b-one.net (Postfix, from userid 106)
	id D44476BADE; Mon, 21 Mar 2011 20:29:40 +0100 (CET)
X-Virus-Scanned: by one.com
X-Spam-Flag: NO
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=4 tests=[none]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144]) by
 mx-s.b-one.net (Postfix) with ESMTP id BAF9470911 for <info@awaresystems.be>;
 Mon, 21 Mar 2011 20:27:22 +0100 (CET)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
 lists.maptools.org (Postfix) with ESMTP id D93CA868F7; Mon, 21 Mar 2011
 14:26:09 -0500 (EST)
Received: from hanghau.pacific.net.hk (hanghau.pacific.net.hk
 [202.64.33.147]) by lists.maptools.org (Postfix) with ESMTP id CDC1E86ABA for
 <tiff@lists.maptools.org>; Mon, 21 Mar 2011 14:22:14 -0500 (EST)
Received: from i7.coppice.org (9.160.232.220.dyn.pacific.net.hk
 [220.232.160.9]) by hanghau.pacific.net.hk with ESMTP id p2LJMAU4012658 for
 <tiff@lists.maptools.org>; Tue, 22 Mar 2011 03:22:11 +0800
Message-ID: <4D87A562.4000108@coppice.org>
Date: Tue, 22 Mar 2011 03:22:10 +0800
From: Steve Underwood <steveu@coppice.org>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13)
 Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc13 Lightning/1.0b3pre
 Thunderbird/3.1.7
MIME-Version: 1.0
To: tiff@lists.maptools.org
Subject: [Tiff] Lab based colormaps
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,

RGB colormaps in TIFF files are specified as being the order min red -> 
max red, min green -> max green, and min blue->max blue. Getting the 
TIFFTAG_COLORMAP tag in libtiff returns a set of three pointers to the 
those red, green and blue sequences, and all seems well where I have 
tried this.

Right now I am working with the test files for TIFF-FX (RFC2301). One of 
these files, l04x_02x.tif, contains an indexed T.43 compressed image. 
The "indexed" tag (346) is set, and the photometric is set to ITULAB. 
Therefore the colormap should be in Lab format, with the ITU gamut. I am 
getting basically the right image after decompression, but with the 
colours scrambled. Obviously libtiff doesn't understand the T.43 
compressed data right now. I am using libtiff to read it raw, and using 
a separate JBIG decoder to recover the decompressed indexed image. I'm 
pretty confident that part is OK, because if I reinterpret the colour 
map I can get a sane looking picture.Here is the oddity.....

If I use libtiff to read the colormap it gives me three arrays, each 256 
elements long, just as would happen for an RGB colour map. If I try to 
interpret these as the L, a, and b arrays, I get crazy colours. If, 
however, I reorder the data as if the TIFF file contains the colour 
table in the order L[0], a[0], b[0], L[1], a[1], b[1], etc. the 
resulting image looks OK. I can't see in the TIFF spec, or the extension 
specs, where the order of Lab colormap data is defined. However, it 
would seem bizarre if it is not in the same order as RGB data.

Has anyone had similar experiences? The test files are supposed to have 
been used for interworking tests with several FAX makers, so I would 
have expected anything as blatantly wrong as this to have been caught 
and fixed.

Steve

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
