2001.07.19 21:29 "LZW TIFFReadScanline woes", by Sean Finn

2001.07.19 21:29 "LZW TIFFReadScanline woes", by Sean Finn

I'm using libTIFF to read/sub-sample a TIFF file.

So, basically, I figure out which lines I want to read, read in the entire line via TIFFReadScanline, and then chop out the sub-sampled pixels I want from that line, then go to the next line.

Everything works fine until I try to read an LZW compressed file. My company has its own LZW license from Unisys, so no worries there. But, I am using the libTIFF LZW package.

When reading the LZW compressed file, the sub-sampling is all wrong, giving me a very chunky and distorted looking image. So, the question is, with LZW, does TIFFReadScanline read in a compressed line's worth of pixels or an uncompressed? In case that wasn't clear, here's a scenario:

Compressed width = 50
Uncompressed width = 100

TIFFReadScanline(m_tif, buf, 1);

Does this uncompress the LZW data (50 bytes), then place the new 100 bytes worth of pixels in my buffer? Or, does it read 100 bytes of LZW data, uncompress it, and put all it can into my buffer (giving me 200 pixels worth)? Since all other compression modules work with my code, I am assuming the problem lies in the LZW code.

Thanks for any help,

Sean
sean@mediacy.com