1TIFFGetField(3TIFF) TIFFGetField(3TIFF)
2
3
4
6 TIFFGetField, TIFFVGetField - get the value(s) of a tag in an open TIFF
7 file
8
10 #include <tiffio.h>
11
12 int TIFFGetField(TIFF *tif, ttag_t tag, ...)
13
14 #include <stdarg.h>
15
16 int TIFFVGetField(TIFF *tif, ttag_t tag, va_list ap)
17 int TIFFGetFieldDefaulted(TIFF *tif, ttag_t tag, ...)
18 int TIFFVGetFieldDefaulted(TIFF *tif, ttag_t tag, va_list ap)
19
21 TIFFGetField returns the value of a tag or pseudo-tag associated with
22 the the current directory of the opened TIFF file tif. (A pseudo-tag
23 is a parameter that is used to control the operation of the TIFF
24 library but whose value is not read or written to the underlying file.)
25 The file must have been previously opened with TIFFOpen(3TIFF). The
26 tag is identified by tag, one of the values defined in the include file
27 tiff.h (see also the table below). The type and number of values
28 returned is dependent on the tag being requested. The programming
29 interface uses a variable argument list as prescribed by the stdarg(3)
30 interface. The returned values should only be interpreted if TIFFGet‐
31 Field returns 1.
32
33 TIFFVGetField is functionally equivalent to TIFFGetField except that it
34 takes a pointer to a variable argument list. TIFFVGetField is useful
35 for layering interfaces on top of the functionality provided by
36 TIFFGetField.
37
38 TIFFGetFieldDefaulted and TIFFVGetFieldDefaulted are identical to
39 TIFFGetField and TIFFVGetField, except that if a tag is not defined in
40 the current directory and it has a default value, then the default
41 value is returned.
42
43 The tags understood by libtiff(3TIFF), the number of parameter values,
44 and the types for the returned values are shown below. The data types
45 are specified as in C and correspond to the types used to specify tag
46 values to TIFFSetField(3TIFF). Remember that TIFFGetField returns
47 parameter values, so all the listed data types are pointers to storage
48 where values should be returned. Consult the TIFF specification (or
49 relevant industry specification) for information on the meaning of each
50 tag and their possible values.
51
52 Tag Name Count Types Notes
53 TIFFTAG_ARTIST 1 char**
54 TIFFTAG_BADFAXLINES 1 uint32*
55 TIFFTAG_BITSPERSAMPLE 1 uint16*
56 TIFFTAG_CLEANFAXDATA 1 uint16*
57 TIFFTAG_COLORMAP 3 uint16** 1<<BitsPerSample arrays
58 TIFFTAG_COMPRESSION 1 uint16*
59 TIFFTAG_CONSECUTIVEBADFAXLINES 1 uint32*
60 TIFFTAG_COPYRIGHT 1 char**
61 TIFFTAG_DATATYPE 1 uint16*
62 TIFFTAG_DATETIME 1 char**
63 TIFFTAG_DOCUMENTNAME 1 char**
64 TIFFTAG_DOTRANGE 2 uint16*
65 TIFFTAG_EXTRASAMPLES 2 uint16*,uint16** count & types array
66 TIFFTAG_FAXFILLFUNC 1 TIFFFaxFillFunc* G3/G4 compression pseudo-tag
67 TIFFTAG_FAXMODE 1 int* G3/G4 compression pseudo-tag
68 TIFFTAG_FILLORDER 1 uint16*
69 TIFFTAG_GROUP3OPTIONS 1 uint32*
70 TIFFTAG_GROUP4OPTIONS 1 uint32*
71 TIFFTAG_HALFTONEHINTS 2 uint16*
72 TIFFTAG_HOSTCOMPUTER 1 char**
73 TIFFTAG_ICCPROFILE 2 uint32*,void** count, profile data
74 TIFFTAG_IMAGEDEPTH 1 uint32*
75 TIFFTAG_IMAGEDESCRIPTION 1 char**
76 TIFFTAG_IMAGELENGTH 1 uint32*
77 TIFFTAG_IMAGEWIDTH 1 uint32*
78 TIFFTAG_INKNAMES 1 char**
79 TIFFTAG_INKSET 1 uint16*
80 TIFFTAG_JPEGCOLORMODE 1 int* JPEG pseudo-tag
81 TIFFTAG_JPEGQUALITY 1 int* JPEG pseudo-tag
82 TIFFTAG_JPEGTABLES 2 uint32*,void** count & tables
83 TIFFTAG_JPEGTABLESMODE 1 int* JPEG pseudo-tag
84 TIFFTAG_MAKE 1 char**
85 TIFFTAG_MATTEING 1 uint16*
86 TIFFTAG_MAXSAMPLEVALUE 1 uint16*
87 TIFFTAG_MINSAMPLEVALUE 1 uint16*
88 TIFFTAG_MODEL 1 char**
89 TIFFTAG_ORIENTATION 1 uint16*
90 TIFFTAG_PAGENAME 1 char**
91 TIFFTAG_PAGENUMBER 2 uint16*
92 TIFFTAG_PHOTOMETRIC 1 uint16*
93 TIFFTAG_PHOTOSHOP 2 uint32*,void** count, data
94 TIFFTAG_PLANARCONFIG 1 uint16*
95 TIFFTAG_PREDICTOR 1 uint16*
96 TIFFTAG_PRIMARYCHROMATICITIES 1 float** 6-entry array
97 TIFFTAG_REFERENCEBLACKWHITE 1 float** 6-entry array
98 TIFFTAG_RESOLUTIONUNIT 1 uint16*
99 TIFFTAG_RICHTIFFIPTC 2 uint32*,void** count, data
100 TIFFTAG_ROWSPERSTRIP 1 uint32*
101 TIFFTAG_SAMPLEFORMAT 1 uint16*
102 TIFFTAG_SAMPLESPERPIXEL 1 uint16*
103 TIFFTAG_SMAXSAMPLEVALUE 1 double*
104 TIFFTAG_SMINSAMPLEVALUE 1 double*
105 TIFFTAG_SOFTWARE 1 char**
106 TIFFTAG_STONITS 1 double**
107 TIFFTAG_STRIPBYTECOUNTS 1 uint32**
108 TIFFTAG_STRIPOFFSETS 1 uint32**
109 TIFFTAG_SUBFILETYPE 1 uint32*
110 TIFFTAG_SUBIFD 2 uint16*,uint32** count & offsets array
111 TIFFTAG_TARGETPRINTER 1 char**
112 TIFFTAG_THRESHHOLDING 1 uint16*
113 TIFFTAG_TILEBYTECOUNTS 1 uint32**
114 TIFFTAG_TILEDEPTH 1 uint32*
115 TIFFTAG_TILELENGTH 1 uint32*
116 TIFFTAG_TILEOFFSETS 1 uint32**
117 TIFFTAG_TILEWIDTH 1 uint32*
118 TIFFTAG_TRANSFERFUNCTION 1 or 3† uint16**1<<BitsPerSample entry arrays
119 TIFFTAG_WHITEPOINT 1 float** 2-entry array
120 TIFFTAG_XMLPACKET 2 uint32*,void** count, data
121 TIFFTAG_XPOSITION 1 float*
122 TIFFTAG_XRESOLUTION 1 float*
123 TIFFTAG_YCBCRCOEFFICIENTS 1 float** 3-entry array
124 TIFFTAG_YCBCRPOSITIONING 1 uint16*
125 TIFFTAG_YCBCRSUBSAMPLING 2 uint16*
126 TIFFTAG_YPOSITION 1 float*
127 TIFFTAG_YRESOLUTION 1 float*‡
128 † If SamplesPerPixel is one, then a single array is returned; otherwise
129 three arrays are returned.
130 ‡ The contents of this field are quite complex. See The ICC Profile
131 Format Specification, Annex B.3 "Embedding ICC Profiles in TIFF Files"
132 (available at http://www.color.org) for an explanation.
133
135 If you can't find the tag in the table above that means this is unsup‐
136 ported tag. But you still be able to read it's value if you know the
137 data type of that tag. For example, if you want to read the LONG value
138 from the tag 33424 and ASCII string from the tag 36867 you can use the
139 following code:
140
141 uint16 count;
142 void *data;
143
144 TIFFGetField(tiff, 33424, &count, &data);
145 printf("Tag %d: %d, count %d0, 33424, *(uint32 *)data, count);
146 TIFFGetField(tiff, 36867, &count, &data);
147 printf("Tag %d: %s, count %d0, 36867, (char *)data, count);
148
149 is not supported by libtiff(3TIFF), library
150
152 1 is returned if the tag is defined in the current directory; otherwise
153 a 0 is returned.
154
156 All error messages are directed to the TIFFError(3TIFF) routine.
157
158 Unknown field, tag 0x%x. An unknown tag was supplied.
159
161 TIFFOpen(3TIFF), TIFFSetField(3TIFF), TIFFSetDirectory(3TIFF), TIFF‐
162 ReadDirectory(3TIFF), TIFFWriteDirectory(3TIFF) libtiff(3TIFF),
163
164 Libtiff library home page: http://www.remotesensing.org/libtiff/
165
166
167
168libtiff March 18, 2005 TIFFGetField(3TIFF)