PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com _____________________________________________________________

From: "Aandi Inston" <[EMAIL PROTECTED]>
I wanted to share with everyone a solution to an interesting Lab color space problem that I discovered empirically, but cannot explain why it works.
...
Through trial and error, I discovered that the *a and *b values have to be XOR'ed with 0x80, and then it works fine.
>
> It doesn't work! (Except in this one case, by good luck).

I disagree with Aandi's objection. At first I thought that
Peter's solution (XORing with 0x80) works only for half of the
possible byte values, but upon reconsidering and some bit picking
I think I can see what's going on.

The main issue here is that TIFF and PDF both support
CIELab color, but both do so with a slightly different interpretation
of the encoding for the a and b values (L is encoded the same
way in both formats): while TIFF calls for a signed interpretation
of a and b bytes, PDF works with unsigned interpretation.

I must confess that I needed some paper before I realized that
XORing with 0x80 is exactly the same as converting from signed
to unsigned interpretation! I therefore believe that this is the
proper approach which conforms to the TIFF and PDF specs.

No, you are missing the vital step of using the Decode array. What,
you say, there isn't a decode array.  Well, actually there always is:
the image samples (which may be 1,2,4,8 or now 16 bits) have to be
converted into the target range using the Decode array in every case,
and the Decode array has a different default for each Color Space.

Surprisingly, the /Decode array doesn't have any significant influence here. Not supplying any Decode array calls for the Lab default array, which maps the a and b values to the interval supplied in the /Range array. Peter used -128...127 which happens to be very close to TIFF's -127...127. Actually, I use -128...127, and it seems to also work well. Now, if anybody could solve this +/- 1 riddle I'd be grateful...

Thomas

P.S.: My feature request for Decode arrays would be to allow
functions in additions to simple interval mapping. This way
we could use the original TIFF pixel data, and fix the data
interpretation gap by supplying a suitable Decode function.
Currently Decode mapping is restricted to linear functions,
which is not sufficient for cases like the nonlinear
signed/unsigned transition.

_______________________________________________________________
Thomas Merz          [EMAIL PROTECTED]        http://www.pdflib.com
Personalize PDF: PDFlib Personalization Server and Block plugin
_______PDFlib - a library for generating PDF on the fly________


To change your subscription: http://www.pdfzone.com/discussions/lists-pdfdev.html



Reply via email to