1 /* $Header: /usr/people/sam/tiff/libtiff/RCS/tiff.h,v 1.36 92/02/19 09:52:30 sam Exp $ */ 2 3 /* 4 * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler 5 * Copyright (c) 1991, 1992 Silicon Graphics, Inc. 6 * 7 * Permission to use, copy, modify, distribute, and sell this software and 8 * its documentation for any purpose is hereby granted without fee, provided 9 * that (i) the above copyright notices and this permission notice appear in 10 * all copies of the software and related documentation, and (ii) the names of 11 * Sam Leffler and Silicon Graphics may not be used in any advertising or 12 * publicity relating to the software without the specific, prior written 13 * permission of Sam Leffler and Silicon Graphics. 14 * 15 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 16 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 17 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 18 * 19 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 20 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 21 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 22 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 23 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 24 * OF THIS SOFTWARE. 25 */ 26 27 #ifndef _TIFF_ 28 #define _TIFF_ 29 /* 30 * Tag Image File Format (TIFF) 31 * 32 * Based on Rev 6.0 from: 33 * Developer's Desk 34 * Aldus Corporation 35 * 411 First Ave. South 36 * Suite 200 37 * Seattle, WA 98104 38 * 206-622-5500 39 */ 40 #define TIFF_VERSION 42 41 42 #define TIFF_BIGENDIAN 0x4d4d 43 #define TIFF_LITTLEENDIAN 0x4949 44 45 typedef struct { 46 unsigned short tiff_magic; /* magic number (defines byte order) */ 47 unsigned short tiff_version; /* TIFF version number */ 48 unsigned long tiff_diroff; /* byte offset to first directory */ 49 } TIFFHeader; 50 51 /* 52 * TIFF Image File Directories are comprised of 53 * a table of field descriptors of the form shown 54 * below. The table is sorted in ascending order 55 * by tag. The values associated with each entry 56 * are disjoint and may appear anywhere in the file 57 * (so long as they are placed on a word boundary). 58 * 59 * If the value is 4 bytes or less, then it is placed 60 * in the offset field to save space. If the value 61 * is less than 4 bytes, it is left-justified in the 62 * offset field. 63 */ 64 typedef struct { 65 unsigned short tdir_tag; /* see below */ 66 unsigned short tdir_type; /* data type; see below */ 67 unsigned long tdir_count; /* number of items; length in spec */ 68 unsigned long tdir_offset; /* byte offset to field data */ 69 } TIFFDirEntry; 70 71 /* 72 * NB: In the comments below, 73 * - items marked with a + are obsoleted by revision 5.0, 74 * - items marked with a ! are introduced in revision 6.0. 75 * - items marked with a $ are obsoleted by revision 6.0. 76 */ 77 78 /* 79 * Tag data type information. 80 * 81 * Note: RATIONALs are the ratio of two 32-bit integer values. 82 */ 83 typedef enum { 84 TIFF_NOTYPE = 0, /* placeholder */ 85 TIFF_BYTE = 1, /* 8-bit unsigned integer */ 86 TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */ 87 TIFF_SHORT = 3, /* 16-bit unsigned integer */ 88 TIFF_LONG = 4, /* 32-bit unsigned integer */ 89 TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */ 90 TIFF_SBYTE = 6, /* !8-bit signed integer */ 91 TIFF_UNDEFINED = 7, /* !8-bit untyped data */ 92 TIFF_SSHORT = 8, /* !16-bit signed integer */ 93 TIFF_SLONG = 9, /* !32-bit signed integer */ 94 TIFF_SRATIONAL = 10, /* !64-bit signed fraction */ 95 TIFF_FLOAT = 11, /* !32-bit IEEE floating point */ 96 TIFF_DOUBLE = 12 /* !64-bit IEEE floating point */ 97 } TIFFDataType; 98 99 /* 100 * TIFF Tag Definitions. 101 */ 102 #define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */ 103 #define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */ 104 #define FILETYPE_PAGE 0x2 /* one page of many */ 105 #define FILETYPE_MASK 0x4 /* transparency mask */ 106 #define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */ 107 #define OFILETYPE_IMAGE 1 /* full resolution image data */ 108 #define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */ 109 #define OFILETYPE_PAGE 3 /* one page of many */ 110 #define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */ 111 #define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */ 112 #define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */ 113 #define TIFFTAG_COMPRESSION 259 /* data compression technique */ 114 #define COMPRESSION_NONE 1 /* dump mode */ 115 #define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */ 116 #define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */ 117 #define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */ 118 #define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */ 119 #define COMPRESSION_JPEG 6 /* !JPEG compression */ 120 #define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */ 121 #define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */ 122 #define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ 123 #define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */ 124 #define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ 125 #define PHOTOMETRIC_MINISWHITE 0 /* min value is white */ 126 #define PHOTOMETRIC_MINISBLACK 1 /* min value is black */ 127 #define PHOTOMETRIC_RGB 2 /* RGB color model */ 128 #define PHOTOMETRIC_PALETTE 3 /* color map indexed */ 129 #define PHOTOMETRIC_MASK 4 /* $holdout mask */ 130 #define PHOTOMETRIC_SEPARATED 5 /* !color separations */ 131 #define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */ 132 #define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */ 133 #define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */ 134 #define THRESHHOLD_BILEVEL 1 /* b&w art scan */ 135 #define THRESHHOLD_HALFTONE 2 /* or dithered scan */ 136 #define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */ 137 #define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */ 138 #define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */ 139 #define TIFFTAG_FILLORDER 266 /* data order within a byte */ 140 #define FILLORDER_MSB2LSB 1 /* most significant -> least */ 141 #define FILLORDER_LSB2MSB 2 /* least significant -> most */ 142 #define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */ 143 #define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */ 144 #define TIFFTAG_MAKE 271 /* scanner manufacturer name */ 145 #define TIFFTAG_MODEL 272 /* scanner model name/number */ 146 #define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */ 147 #define TIFFTAG_ORIENTATION 274 /* +image orientation */ 148 #define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */ 149 #define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */ 150 #define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */ 151 #define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */ 152 #define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */ 153 #define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */ 154 #define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */ 155 #define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */ 156 #define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */ 157 #define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */ 158 #define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */ 159 #define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */ 160 #define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */ 161 #define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */ 162 #define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */ 163 #define TIFFTAG_PLANARCONFIG 284 /* storage organization */ 164 #define PLANARCONFIG_CONTIG 1 /* single image plane */ 165 #define PLANARCONFIG_SEPARATE 2 /* separate planes of data */ 166 #define TIFFTAG_PAGENAME 285 /* page name image is from */ 167 #define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */ 168 #define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */ 169 #define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */ 170 #define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */ 171 #define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */ 172 #define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */ 173 #define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */ 174 #define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */ 175 #define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ 176 #define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */ 177 #define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */ 178 #define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */ 179 #define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */ 180 #define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */ 181 #define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */ 182 #define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */ 183 #define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */ 184 #define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ 185 #define RESUNIT_NONE 1 /* no meaningful units */ 186 #define RESUNIT_INCH 2 /* english */ 187 #define RESUNIT_CENTIMETER 3 /* metric */ 188 #define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */ 189 #define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */ 190 #define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */ 191 #define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */ 192 #define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */ 193 #define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ 194 #define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */ 195 #define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */ 196 #define TIFFTAG_SOFTWARE 305 /* name & release */ 197 #define TIFFTAG_DATETIME 306 /* creation date and time */ 198 #define TIFFTAG_ARTIST 315 /* creator of image */ 199 #define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */ 200 #define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */ 201 #define TIFFTAG_WHITEPOINT 318 /* image white point */ 202 #define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */ 203 #define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */ 204 #define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */ 205 #define TIFFTAG_TILEWIDTH 322 /* !rows/data tile */ 206 #define TIFFTAG_TILELENGTH 323 /* !cols/data tile */ 207 #define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */ 208 #define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */ 209 #define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */ 210 #define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */ 211 #define CLEANFAXDATA_CLEAN 0 /* no errors detected */ 212 #define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */ 213 #define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */ 214 #define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */ 215 #define TIFFTAG_INKSET 332 /* !inks in separated image */ 216 #define INKSET_CMYK 1 /* !cyan-magenta-yellow-black */ 217 #define TIFFTAG_INKNAMES 333 /* !ascii names of inks */ 218 #define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */ 219 #define TIFFTAG_TARGETPRINTER 337 /* !separation target */ 220 #define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */ 221 #define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */ 222 #define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */ 223 #define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */ 224 #define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */ 225 #define SAMPLEFORMAT_INT 1 /* !signed integer data */ 226 #define SAMPLEFORMAT_UINT 2 /* !unsigned integer data */ 227 #define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */ 228 #define SAMPLEFORMAT_VOID 4 /* !untyped data */ 229 #define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */ 230 #define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */ 231 #define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */ 232 #define JPEGPROC_BASELINE 1 /* !baseline sequential */ 233 #define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */ 234 #define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */ 235 #define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */ 236 #define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */ 237 #define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */ 238 #define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */ 239 #define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */ 240 #define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */ 241 #define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */ 242 #define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */ 243 #define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */ 244 #define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */ 245 #define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */ 246 #define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */ 247 #define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */ 248 /* tags 32995-32999 are private tags registered to SGI */ 249 #define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */ 250 #define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */ 251 #define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */ 252 #define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */ 253 #endif /* _TIFF_ */ 254