2002.09.30 18:23 "Re: Seek help", by Zhongfu Zhou
Thank you very much for your direction. I urgly need to generate some images from data produced in my simulating programme by Fortran. I have spent two days and tried many methods to deal with it, but it still doesn't work. I am really not familar with both C and tifflib.
Actually I want to set the levels of gray up to 256, i.e. the data marix maybe like, not only 0 and 1:
1, 120, 126...
30, 45, 0...
and the size maybe till 1000*1000.
I tried to define "unsigned char buffer", but it only can be used to save single character.
In message <3D989131.firstname.lastname@example.org> email@example.com writes:
> Zhongfu Zhou wrote:
> > uint32 lSize;
> > int buffer;
> > TIFFSetField(image,TIFFTAG_BITSPERSAMPLE, 8);
> > TIFFWriteEncodedStrip(image,0,buffer,100);
> Your fundamental mistake is using a 32 bit integer buffer 'buffer', when
> actually writing an 8bit per sample image. Try declaring buffer as
> "unsigned char buffer" instead. I haven't tried your code so there
> may be other problems as well.