1999.11.12 17:54 "Error "PackBitsDecode : not enough data for scanline ..."", by Raphaël Marc


Using the TIFF library, when I read a small bilevel(a) TIFF image, the following messages are displayed in a dialog box (and my program doesn't read correctly the image):

PackBitsDecode: not enough data for scanline 0
PackBitsDecode: not enough data for scanline 1

(a) bitspersample=1, samplesperpixel=1

This happens only on small images: I'm testing my program on the same image which I'm rescaling. For instance, at the beginning, its size is 200(width)*100. When I'm scaling down this image, my program runs correctly untill width = 18. For width <=17, the error messages are displayed. And when I'm scaling up the image from 17 to 18, the error messages are still displayed!

My code is like:

buf = (unsigned char* )_TIFFmalloc(sizeLine);
for (row = 0; row < lenght; row++) {
        if (TIFFReadScanline(tif, buf, row, 0))   /* the error happens there */

Any help appreciated.