1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
TIFF *tif = TIFFOpen("Image.tif","w");
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, rows);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, columns);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_SEPARATE);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
TIFFSetField(tif, TIFFTAG_XRESOLUTION, imageXres);
TIFFSetField(tif, TIFFTAG_YRESOLUTION, imageYres);
TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, res_unit);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, 0);
for (i = 0; i < rows; i++){
TIFFWriteScanline(tif, &dataArray[i * columns], i, 0);
}
TIFFClose(tif);
|