AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2003.09.30 14:38 "[Tiff] how can i show the different TIFF tile image on the computer screen?", by Zuyuan Wang
[...]
2003.10.31 16:40 "[Tiff] Re: ask for suggestions....", by
2003.10.31 16:45 "[Tiff] Re: ask for suggestions....", by
2003.11.03 15:36 "[Tiff] Re: ask for suggestions....", by Zuyuan Wang
[...]

2003.10.31 16:45 "[Tiff] Re: ask for suggestions....", by

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,

You should really send the above to the mailing list as well.

I see you are using TIFFReadRGBATile() while previous email seemed to suggest you were using TIFFReadTile(). These are fundamentally different! The data organization in a result from TIFFReadRGBATile() will be "RGBARGBA...".

I am attaching the TIFFReadRGBATile() manual pages. Please review them for details on this function.

The code segment isn't large enough to analyse it properly. I don't know how you have created the output file for instance.

Best regards,

--

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

TIFFReadRGBATile(3T) TIFFReadRGBATile(3T)

NNAAMMEE

        TIFFReadRGBATile  -  read  and decode an image tile into a fixed-format raster

SSYYNNOOPPSSIISS

        ##iinncclluuddee <<ttiiffffiioo..hh>>
        ##ddeeffiinnee TTIIFFFFGGeettRR((aabbggrr))   ((((aabbggrr)) && 

 00xxffff))

........


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