2000.10.19 19:27 "reading LAB files", by Michael O'Rourke

2000.10.19 21:11 "Re: reading LAB files", by Joris Van Damme

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.

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);
  if (aa and 128)=0 then
  if (ab and 128)=0 then

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,