| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2007.11.15 11:42 "Re: Simple code to write Tiff images from Raw data", by Jason TillettHere is my simple code snippet.
I have not had any compatibility problems
but maybe I just got lucky so far...
TIFF *out=TIFFOpen(fn,"w");
int width=nx;int height=ny;int sampleperpixel=1; //RGBA=4 bw/gray=1
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
TIFFSetField(out, TIFFTAG_IMAGELENGTH, height);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, sampleperpixel);
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, ny);
// Write the information to the tiff file
if(TIFFWriteEncodedStrip(out, 0, a, width * height * sampleperpixel) ==
0){
fprintf(stderr, "Could not write image\n");
}
TIFFClose(out);
|
|||||||