2005.02.11 05:37 "[Tiff] facing problems with writing compressed tiff image strips.", by Priyanshu Sharma

2005.02.11 05:37 "[Tiff] facing problems with writing compressed tiff image strips.", by Priyanshu Sharma

Hi all,

I am new to the community as this is my first post, and recently i have started my work on TIFF images. Using the libtiff library version 3.6.1 i am trying to read the compressed data strip( ie using TIFFReadEncodedStrip() in my code).

i am giving my logic below.

NoOfStrips = TIFFNumberOfStrips(fp_TIFF_read);
buf size i am taking as the StripByteCount for the respective strips.
for (int line =0;line<NoOfStrips;line++)
        {
                buf = (char*) malloc(bufSize  * sizeof(char));


                if(TIFFReadEncodedStrip(fp_TIFF_read,line,buf, bufSize) < 0)
                {
                        printf("\n\n error in reading the file\n\n");
                        res = false;
                        break;
                }

                if(TIFFWriteEncodedStrip(fp_TIFF_write,line,buf, bufSize) < 0)
                {
                        printf("\nerror while writing TIFF file");
                        res = false;
                        break;
                }

      free(buf);

        }

ideally this code should copy the data strips into another tiff file where i have already written the respective tags.

it is not working in this case. i am unable to figure out my mistake. Can anyone help me in this regard.

Thanx in advance

Priyanshu
BITS, Pilani