AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2002.10.30 10:58 "Read tiff tiles jpeg compress image.", by
2002.10.30 10:49 "Re: Read tiff tiles jpeg compress image.", by Julien Demaria

2002.10.30 10:49 "Re: Read tiff tiles jpeg compress image.", by Julien Demaria

Hi,

I had the same problem with TIFF tiled JPEG when upgrade to libtiff 3.5.7
from 3.5.5, and I 've made 2 little patchs for this function.
I don't know if it's a bug, but I really don't understand the code if it isn't.
Sorry, I don't have posted this problems on bugzilla...

         /*
          * Check image parameters and set decompression parameters.
          */

         segment_width = td->td_imagewidth;
         segment_height = td->td_imagelength - tif->tif_row;
         if (isTiled(tif)) {
                 if (segment_height > td->td_tilelength)
                         segment_height = td->td_tilelength;
/*************************************************** DeM PATCH!!!!!! *****/
                 if (segment_width > td->td_tilewidth)
                         segment_width = td->td_tilewidth;
/************************************************ End of DeM PATCH!!!!!!
*****/
                 sp->bytesperline = TIFFTileRowSize(tif);
         } else {
                 if (segment_height > td->td_rowsperstrip)
                         segment_height = td->td_rowsperstrip;
                 sp->bytesperline = TIFFScanlineSize(tif);
         }
         if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0) {
                 /*

                  * For PC 2, scale down the expected strip/tile size
                  * to match a downsampled component
                  */

        segment_width = TIFFhowmany(segment_width, sp->h_sampling);
        segment_height = TIFFhowmany(segment_height, sp->v_sampling);
}

/************************************************** DeM PATCH !!!!!! *****/
/*      if (sp->cinfo.d.image_width != segment_width || */
/*          sp->cinfo.d.image_height != segment_height) { */
/*              TIFFError(module, "Improper JPEG strip/tile size"); */
/*              return (0); */
/*      } */
/******************************************* End of DeM PATCH !!!!!! *****/

if (sp->cinfo.d.num_components != (td->td_planarconfig == PLANARCONFIG_CONTIG?

     td->td_samplesperpixel: 1)) {
        TIFFError(module, "Improper JPEG component count");
        return (0);
}

Best Regards,

Julien Demaria

I have no problem to compress/decompres tiff strips compress whith jpeg. I'm trying to decompres tiff tiles (tag = 7) compress whith jpeg without success.

In the static function JPEGPreDecode I always have the error: if (sp->cinfo.d.image_width != segment_width ||

    sp->cinfo.d.image_height != segment_height) {
    TIFFError(module, "Improper JPEG strip/tile size");
    return (0);

segment_width equal the image witdh (1024 for example) and sp->cinfo.d.image_width is the width of the tile (256 for example) The other test sp->cinfo.d.image_height != segment_height is correct: sp->cinfo.d.image_height = segment_height is correct = the tile length (256 in my case)

Is somebody known how to compress/decompress tiff tiles images with jpeg algo from tif_jpeg.c?