AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2002.09.11 13:55 "Tags modifcation", by Gerben Koopmans
2002.09.11 14:21 "Re: Tags modifcation", by Frank Warmerdam
2002.09.30 18:23 "Re: Seek help", by Zhongfu Zhou
2002.09.30 17:34 "Seek help", by Zhongfu Zhou
2002.09.30 18:00 "Re: Seek help", by Frank Warmerdam
2002.10.01 04:36 "Re: Seek help", by Peter Montgomery

2002.10.01 04:36 "Re: Seek help", by Peter Montgomery

Zhongfu,

An unsigned char will allows the values from 0 to 255. The array size can be as big as you want, just declare it or malloc it with enough memory. The statement "unsigned char buffer[100]" will give allow up to a 10 X 10 (or 2 X 50, etc) image with values from 0 to 255. You say that "t only can be used to save single character". Is the compiler giving you an error message? If so, then what is the exact error message and what is the exact line of code that it is complaining about. Arrays in C are very closely tied to pointers, and if you're not too familiar with C, it's easy to get the code wrong.

    Thanks,
    PeterM

Cc: "Zhongfu Zhou" <zhongfu.zhou@wolfson.oxford.ac.uk>; "TIFF Mailing
List" <tiff@olympiakos.com>
Sent: Monday, September 30, 2002 11:23 AM
Subject: Re: Seek help

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.

> > Frank Warmerdam, warmerdam@pobox.com