Received: from [209.42.233.245] by phillip.cerious.com (NTMail 3.03.0017/7.aaxh) with ESMTP id pcrews for <pcrews@cerious.com>; Fri, 20 Oct 2000 12:21:02 -0400
Received: from gate7.olympiakos.com (207.176.88.85) by mail2.calvander.com
 with ESMTP (Eudora Internet Mail Server 3.0) for <pcrews@cerious.com>; 
 Fri, 20 Oct 2000 01:10:45 -0400
Received: from localhost (daemon@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) with SMTP id AAA24962;
	Fri, 20 Oct 2000 00:14:21 -0400
Received: by gate7.olympiakos.com (bulk_mailer v1.9); Fri, 20 Oct 2000 00:02:48 -0400
Received: (from majordom@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) id AAA24173
	for tiff-outgoing; Fri, 20 Oct 2000 00:02:29 -0400
X-Authentication-Warning: gate7.olympiakos.com: majordom set sender to owner-tiff@olympiakos.com using -f
Received: from firebird.planetinternet.be (firebird.planetinternet.be [195.95.34.5])
	by gate7.olympiakos.com (8.9.3/8.9.3) with ESMTP id AAA24163
	for <tiff@olympiakos.com>; Fri, 20 Oct 2000 00:02:25 -0400
Received: from planetinternet.be (u212-239-133-60.dialup.planetinternet.be [212.239.133.60])
	by firebird.planetinternet.be (8.11.0/8.10.0) with ESMTP id e9JLIxS15105;
	Thu, 19 Oct 2000 23:18:59 +0200
Message-ID: <39EF639D.783CDC4B@planetinternet.be>
Date: Thu, 19 Oct 2000 23:11:57 +0200
From: Joris Van Damme <as.van.damme.joris@planetinternet.be>
Organization: AWare Systems
X-Mailer: Mozilla 4.61 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: "Michael O'Rourke" <morourke@Adobe.COM>,
        TIFF Mailing List <tiff@olympiakos.com>
Subject: Re: reading LAB files
References: <IJEEKGEBDCHCGMJDLMHHGEDBCCAA.morourke@adobe.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-tiff@olympiakos.com

Michael O'Rourke wrote:
> 
> I seem to be having trouble reading LAB files.
> 
> I have an LAB file where Photshop show the first pixel as (55,22,-10).
> 
> When I read it into an unsigned char array with ReadScanline, I get (140,
> 22, 146) which maps to (-116, 22, -10) when typecast to signed chars.
> 
> So, what's up with the -116? Does libtiff do something special to LAB files?
> I grep'd the code, but didn't seem to find anything.
> 
> Michael

Hi Michael,


Yeah, I remember having to search on that mysterie myself. Here's a
pascal procedure for you, to convert tiff 24bits lab into the floating
CIE thing.

procedure XPVtifflab24ToVlabf(const al,aa,ab: Integer; var bl,ba,bb:
Cft);
begin
  bl:=al/2.55;
  if (aa and 128)=0 then
    ba:=aa
  else
    ba:=aa-256;
  if (ab and 128)=0 then
    bb:=ab
  else
    bb:=ab-256;
end;

Guess you're probably more of a C man. Anyway, it shouldn't be to heard
to read. It simply says that the 0-255 L byte is mapped onto the 0-100 L
component by dividing it with 2.55. Bit 7 of the a and b bytes are
checked. If this bit is not set, the a (or b) byte simply is the
unchanged component value. If it is set, substract 256 to get the
component value. Note: when I say byte, I mean the unsigned 8 bit thing.
Also note that probably most, if not all, of my test files are written
by photoshop, so we'll have to simply hope they are (de facto) correct.

BTW, can you possibly satisfy my curiousity on this one: howcome an
@adobe.com mailer is obviously working with LibTiff? Does the @adobe.com
mean you're working there? If so, does that mean adobe actually uses
LibTiff? And howcome you don't know about this if you work there? Seems
as if there is a bit to much in this byte, I'ld say.



Hope this helps,


Joris

