AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
November 2008

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2008.11.26 15:15 "TIFFWriteEncodedStrip LZW compression failing for certain input", by <paavo@osa.pri.ee>
2008.11.26 15:53 "Re: TIFFWriteEncodedStrip LZW compression failing for certain input", by Frank Warmerdam
2008.11.27 10:49 "Re: TIFFWriteEncodedStrip LZW compression failing for certain input", by <paavo@osa.pri.ee>
2008.11.27 13:23 "Re: TIFFWriteEncodedStrip LZW compression failing for certain input", by Frank Warmerdam

2008.11.26 15:15 "TIFFWriteEncodedStrip LZW compression failing for certain input", by <paavo@osa.pri.ee>

Hi all,

I hope this is the proper place for problems meant for libtiff
developers/maintainers, if not, please suggest a better one!

In short, my problem is that TIFFWriteEncodedStrip in LZW mode is
producing corrupt output for some image content. The output file is 12
bytes larger than it would be with no compression, and when later read
back, I get a warning from the reader (LZWDecode: Strip 0 not terminated
with EOI code) and the result data appears to be changed to some extent.
When reading by ImageMagick library I get messages:

display: LZWDecode: Strip 0 not terminated with EOI code. `test2.tiff'.
display: LZWDecode: Not enough data at scanline 1302 (short 1277 bytes).
`test2.tiff'.


The image is a 16bpp grayscale image of size 1400x1400. It is filled by
numbers according to formula "x*10+y*10", where x and y are the pixel
coordinates 0..1399. I attempt to write the whole image in a single strip.

I have installed my own writeproc by TIFFClientOpen, so I can see in the
debugger from where it is called, it's from LZWEncode() and
TIFFFlushData1(), from the section

if (op > limit) {
	tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata);
	TIFFFlushData1(tif);
	op = tif->tif_rawdata;
}

If the image is of different content, e.g. "x%10 + y%10" for example, then
I get write request from another place (TIFFAppendToStrip()) and
everything works fine, so I suspect that the problem has to do with the
(op > limit) branch. Maybe I am not calling the libtiff library properly?

Any ideas?
TIA

Paavo