
Thread
2002.09.30 18:23 "Re: Seek help", by Zhongfu Zhou
Dear Frank,
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...
.........
255, 19,...
and the size maybe till 1000*1000.
I tried to define "unsigned char buffer[100]", but it only can be used to save single character.
Best regards,
Zhongfu
In message <3D989131.5050004@pobox.com> warmerdam@pobox.com writes:
> Zhongfu Zhou wrote:
> > uint32 lSize;
> > int buffer[100];
>
>...
>
> > TIFFSetField(image,TIFFTAG_BITSPERSAMPLE, 8);
>
>...
>
> > TIFFWriteEncodedStrip(image,0,buffer,100);
>
> Zhou,
>
> 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[100]" instead. I haven't tried your code so there
> may be other problems as well.