From: zuyuan.wang@wsl.ch (Zuyuan Wang)
Date: Mon, 03 Nov 2003 16:23:44 +0100
Subject: [Tiff] Re: ask for suggestions....
In-Reply-To: <20031031113532.GC11503@ak4719.spb.edu>
References: <5.2.1.1.1.20031031112957.00eb82a0@mail.wsl.ch>
 <5.2.1.1.1.20031030164934.00ebad40@mail.wsl.ch>
 <5.2.1.1.1.20031030164934.00ebad40@mail.wsl.ch>
 <5.2.1.1.1.20031031112957.00eb82a0@mail.wsl.ch>
Message-ID: <5.2.1.1.1.20031103161149.00ecc008@mail.wsl.ch>

Dear Andrey V. Kiselev,
  Thanks a lot for your mail. As to my problem, I realy not know how to 
write the TIFF image with the TIFFWriteScanline. For example, I write the 
following code just to test whether TIFFWriteScanline can works:
*******
   OUT_tif = TIFFOpen(OUT_filename, "w");
   row=1;

   TIFFSetField(OUT_tif, TIFFTAG_IMAGEWIDTH,tileWidth);   //tileWidth=256
   TIFFSetField(OUT_tif, TIFFTAG_IMAGELENGTH,row);
   TIFFSetField(OUT_tif, TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);
   TIFFSetField(OUT_tif, TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_RGB);
   TIFFSetField(OUT_tif, TIFFTAG_BITSPERSAMPLE,8);
   TIFFSetField(OUT_tif, TIFFTAG_SAMPLEFORMAT,3);
   TIFFSetField(OUT_tif, TIFFTAG_COMPRESSION,COMPRESSION_NONE);

   bufscanline_8= (uint32 *) malloc(tileWidth*3*sizeof(uint32));

   for(x=0;x<tileWidth;x++)
           *(bufscanline_8+x)=23;  // just set the buffer to a constant

   TIFFWriteScanline(OUT_tif,bufscanline_8, row,0);

*********

And at last, I can't open the OUT_tif file.

Would you please tell me that what't wrong with the above code? What's the 
data format of the TIFFWriteScanline? Is the data arrange shoulc be ' 
RGBRGB.....' ? All data is uint32 or not?

Thanks a lot for your kind help.....

Best regards...
Zuyuan







At 14:35 31.10.2003 +0300, you wrote:
>Hi,
>
>On Fri, Oct 31, 2003 at 11:41:05AM +0100, Zuyuan Wang wrote:
> >   Thanks very much for your mail. Because I am a new to TIFF, there is so
> > many problem.... Thanks again for your kind help.
> >    After I used the 'TIFFReadTile(IN_tif, buf_8,col,row,0,0)' to read the
> > tile data, I used 'bufscanline_8[position]=(buf_8[(x+y*tileWidth)*3])' to
> > read out the data,but when I print it out, they are all like
> > '-842150451'. It shows that I make the wrong way for reading the data out.
> > On the other hand, I tried TIFFGerR() to get the data, and later on write
> > it into the file, but the file could not be open.
> >  Would you like to tell me 1)what's the format of the tile image read by
> > the TIFFReafTile, is it 'RGBRGBRGB....', for my image,  they are
> > 'PLANARCONFIG_CONTIG'.
>
>As Frank said, you should supply us with the tiffinfo report for your
>file before we can discuss how this file could be read.
>
> >  2)How to use ' TIFFWrteScanline'? Is it possible for me to read one tile
> > image line by line, and write into file line by line by using '
> > TIFFWriteScanline' ?
>
>Yes, when you will have a buffer filled with data you can write this
>buffer line by line.
>
>
>--
>Andrey V. Kiselev
>Home phone:  +7 812 5274898  ICQ# 26871517
>_______________________________________________
>Tiff mailing list
>Tiff@remotesensing.org
>http://remotesensing.org/mailman/listinfo/tiff




------
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  


