2003.10.31 00:45 "ask for suggestions....", by Zuyuan Wang

2003.10.31 16:40 "[Tiff] Re: ask for suggestions....", by Zuyuan Wang

Dear Frank,

Thanks a lot for your reply. As to the image I deal with, the other tag informaiton is:

************
TIFFTAG_SAMPLESPERPIXEL: 3
TIFFTAG_BITSPERSAMPLE:8
TIFFTAG_PLANARCONFIG: PLANARCONFIG_CONTIG
*************

And I read the tile as the following:

*************
# define uint8_T   unsigned int
TIFFGetFieldDefaulted(IN_tif, TIFFTAG_SAMPLESPERPIXEL, &spp);
TIFFGetFieldDefaulted(IN_tif, TIFFTAG_BITSPERSAMPLE, &bps);
col=0;
row=0;
if(config==PLANARCONFIG_CONTIG)   {
       /* Chunky mode - RGBRGBRGB... */
        if (bps==8) {
        buf_8 = (uint8_T *) malloc(tileSize*sizeof(uint8_T));
       if (TIFFReadRGBATile(IN_tif, buf_8,col,row,0,0 )==-1){
       exit;}
       for (x=0;x<tileLength;x++)
      {  position=0;
         bufscanline_8= (uint8_T *) malloc(tileWidth*spp*sizeof(uint8_T));
          for (y=0;y<tileWidth;y++)
          {
            bufscanline_8[position]=buf_8[((x+y*tileWidth)*3]);
              bufscanline_8[position+1]=buf_8[(x+y*tileWidth)*3+1]);
              bufscanline_8[position+2]=buf_8([(x+y*tileWidth)*3+2]);
  //          printf(" %d  \n",bufscanline_8[position]);
             position=position+3;
           }
         TIFFWriteScanline(OUT_tif,bufscanline_8, x, 0);
         free(bufscanline_8);
       }
     free(buf_8);
       }
    }
  ************

Would you please tell me what's wrong with the above code?
Waiting for you kind suggestions eagerly!

------
Zuyuan Wang
Swiss Federal Research Institute WSL
Zuercherstr. 111, CH-8903 Birmensdorf, SWITZERLAND
Phone: +41 1 739 2691 Fax: +41 1 739 2215
Email: zuyuan.wang@wsl.ch


Editor's note: This mail was not originally archived, and has been reconstructed from quotes.