AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

2007.04.09 16:55 "[Tiff] Modify decode tiff file including JPG data", by 刘阳.印艺

Hello

In verion 3.8.2, when reading tiff file including JPG data, there turns out to be a black block.

I checked the lib and find that, this may caused by a place that Color Space Converting from CMYK to RGB is not correct. I list it here and sharing it

It is in the file tif_getimage.c. The function is DECLAREContigPutFunc(putRGBcontig8bitCMYKtile)

there used to be

DECLAREContigPutFunc(putRGBcontig8bitCMYKtile)

{

    int samplesperpixel = img->samplesperpixel;

    uint16 r, g, b, k;

    (void) x; (void) y;

    fromskew *= samplesperpixel;

    while (h-- > 0) {

         UNROLL8(w, NOP,

             k = 255 - pp[3];

             r = (k*(255-pp[0]))/255;

             g = (k*(255-pp[1]))/255;

             b = (k*(255-pp[2]))/255;

             *cp++ = PACK(r, g, b);

             pp += samplesperpixel);

         cp += toskew;

         pp += fromskew;

    }

and currently, I change it to

DECLAREContigPutFunc(putRGBcontig8bitCMYKtile)

{

    int samplesperpixel = img->samplesperpixel;

    uint16 r, g, b, k;

    (void) x; (void) y;

    fromskew *= samplesperpixel;

    while (h-- > 0) {

         UNROLL8(w, NOP,

                   r = pp[0];

                   g = pp[1];

                   b = pp[2];

                   k = pp[3];

                   *cp++ = PACK4(r,g,b,k);

             pp += samplesperpixel);

         cp += toskew;

         pp += fromskew;

    }

}

then, the tiff file with JPG data can be read.