2003.09.20 20:07 "[Tiff] (no subject)", by Pushkar Pradhan

2003.09.20 20:07 "[Tiff] (no subject)", by Pushkar Pradhan

I'm unable to read a RGB image (strip oriented) correctly, this is my code:

     for(strip = 0; strip < TIFFNumberOfStrips(tif); strip+=3) {
      size = TIFFReadEncodedStrip(tif, strip, bufRGB, (tsize_t)-1);
      size = TIFFReadEncodedStrip(tif, strip+1, bufRGB+size, (tsize_t)-1);
      size = TIFFReadEncodedStrip(tif, strip+2, bufRGB+(size*2), (tsize_t)-1);
      printf("read %d bytes\n", size);

      size = TIFFWriteEncodedStrip(wtif, strip, bufRGB, size);
      size = TIFFWriteEncodedStrip(wtif, strip+1, bufLHS+(size),
                                   size);
      size = TIFFWriteEncodedStrip(wtif, strip+2, bufLHS+(size*2),
                                   size);
      printf("wrote %d bytes\n", size);
    }

The img. is 512X512, rows per strip = 1 and separate image planes. I get wrong/junk values in the o/p image. Can somebody tell the mistake in my code?

Pushkar Pradhan