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