AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.08.11 18:08 "[Tiff] over-read w/ libtiff 3.5.7 reading jpeg compressed image", by Mark Pilon
2005.08.11 18:16 "Re: [Tiff] over-read w/ libtiff 3.5.7 reading jpeg compressed image", by Bob Friesenhahn

2005.08.11 18:08 "[Tiff] over-read w/ libtiff 3.5.7 reading jpeg compressed image", by Mark Pilon

I'm trying to read a TIFF image w/ jpeg compression [tiffinfo below], alloc a buffer sufficient for 1 scan line; the read seems to read 16 lines, overrunning the buffer and the tif->tif_row count isn't correctly handled.

as I try to read row 1 after reading row 0, I get the "Compression algorithm does not support random access" message and later a SEGV.

below is a gdb session - the 1'st call to TIFFReadScanline()

Breakpoint 1, TIFFReadScanline (tif=0x4aa032e8, buf=0x4aa07ed8, row=0,

    sample=0) at libtiff/tif_read.c:99
99 if (!TIFFCheckRead(tif, 0))
(gdb) n
101 if( (e = TIFFSeek(tif, row, sample)) != 0) {
(gdb)
105 e = (*tif->tif_decoderow)
(gdb) p tif->tif_row
$1 = 0
(gdb) n
107 tif->tif_row++;
(gdb) p tif->tif_row
$2 = 16
(gdb) n
108 if (e)
(gdb) p tif->tif_row
$3 = 17
(gdb)

-----------------------------------------------------------

I'm fine with getting 16 rows if I can querry for that and know how large to make the scanline buffer. I don't see a work-around for tif->tif_row moving from 0 to 17 -- I believe it should be 16 as rows 0 - 15 [1 strip] are being read.

I've tried searching the archives and found some suggestions to use the read RGBA -functions, but I need to preserve the native color space [for all images we handle] so to apply ICC profile -based color correction.

[ I'd _love_ to use the RGBA handlers -- much simpler! and I have a complementary problem reading strips -- some of our images are 1 strip for the entire image and consume too much memory, which is why I'm trying to read rows. ]

Is there a hierarchy of approaches I should be trying?

is there a sample application which shows the right approach to reading an arbitrary tiff image?

thanks,

Mark

mpilon@midrivers.com

tiffinfo for the offending job:
tiffinfo /rd/tests/gld/tiff/QL/TA1BSJUA.tif

TIFF Directory at offset 0x58930
    Image Width: 1700 Image Length: 2200
    Resolution: 200.327, 200.327 pixels/inch
    Bits/Sample: 8
    Compression Scheme: JPEG
    Photometric Interpretation: min-is-black
    Orientation: row 0 top, col 0 lhs
    Samples/Pixel: 1
    Rows/Strip: 16
    Planar Configuration: single image plane

ICC Profile: <present>, 432 bytes
JPEG Tables: (289 bytes)