AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2004.10.25 12:27 "[Tiff] read 5 bands geotiff image", by Zheng Hu
2004.10.25 12:53 "Re: [Tiff] read 5 bands geotiff image", by Frank Warmerdam

2004.10.25 12:53 "Re: [Tiff] read 5 bands geotiff image", by Frank Warmerdam

I write a code to read my 5 bands geotiff image

                unsigned char *buf;
                float *test = &buf;

                buf = _TIFFmalloc(scansize);
                for (line = 0; line < 5; line++)   //5 pixel
                {
                        int i;
                        const char *sep = "";
                        //float *test = &buf;
                        //TIFFReadScanline(tif, test, line, 0);
                        fprintf(stdout, "%d:", line);
                                for (i = 0; i < 50; i++)   // 50 length
                                {
                                                int j;
                                                TIFFReadScanline(tif, test, i, line);
                                                fprintf(stdout, "%s", sep);

Zheng Hu,

You should be passing buf to TIFFReadScanline(), not a pointer to the buf pointer.

In general when asking questions like this it is helpful to provide a tiffinfo report for the file in question. Many aspects of problems are related to the specifics of the file in question.

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