2008.11.27 10:49 "Re: [Tiff] TIFFWriteEncodedStrip LZW compression failing for certain input", by Paavo
In short, my problem is that TIFFWriteEncodedStrip in LZW mode is producing corrupt output for some image content.
I have found out it was my mistake. I read the strip back in by TIFFReadRawStrip(), but did call the wrong function to determine the initial buffer size (TIFFStripSize() instead of TIFFRawStripSize()). Thus, if the compressed data was larger than the original, I failed to capture the extra bytes.
The question remains why the image is not compressable by LZW, is it some fundamental problem with the algorithm? For example, gzip is able to compress the uncompressed TIFF file with the same image 128 times!
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.