2 * maketif.c -- creates a little TIFF file, with
3 * the XTIFF extended tiff example tags.
10 void SetUpTIFFDirectory(TIFF *tif);
11 void WriteImage(TIFF *tif);
18 TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */
20 tif=XTIFFOpen("newtif.tif","w");
21 if (!tif) goto failure;
23 SetUpTIFFDirectory(tif);
30 printf("failure in maketif\n");
31 if (tif) XTIFFClose(tif);
36 void SetUpTIFFDirectory(TIFF *tif)
38 double mymulti[6]={0.0,1.0,2.0, 3.1415926, 5.0,1.0};
40 char *ascii="This file was produced by Steven Spielberg. NOT";
42 TIFFSetField(tif,TIFFTAG_IMAGEWIDTH,WIDTH);
43 TIFFSetField(tif,TIFFTAG_IMAGELENGTH,HEIGHT);
44 TIFFSetField(tif,TIFFTAG_COMPRESSION,COMPRESSION_NONE);
45 TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_MINISBLACK);
46 TIFFSetField(tif,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);
47 TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE,8);
48 TIFFSetField(tif,TIFFTAG_ROWSPERSTRIP,20);
50 /* Install the extended TIFF tag examples */
51 TIFFSetField(tif,TIFFTAG_EXAMPLE_MULTI,6,mymulti);
52 TIFFSetField(tif,TIFFTAG_EXAMPLE_SINGLE,mysingle);
53 TIFFSetField(tif,TIFFTAG_EXAMPLE_ASCII,ascii);
57 void WriteImage(TIFF *tif)
62 memset(buffer,0,sizeof(buffer));
63 for (i=0;i<HEIGHT;i++)
64 if (!TIFFWriteScanline(tif, buffer, i, 0))
65 TIFFErrorExt(tif->tif_clientdata, "WriteImage","failure in WriteScanline\n");