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 li‐
24 brary 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 re‐
28 turned is dependent on the tag being requested. The programming inter‐
29 face uses a variable argument list as prescribed by the stdarg(3) in‐
30 terface. The returned values should only be interpreted if TIFFGetField
31 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 pa‐
47 rameter 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 const char**
54 TIFFTAG_BADFAXLINES 1 uint32_t*
55 TIFFTAG_BITSPERSAMPLE 1 uint16_t*
56 TIFFTAG_CLEANFAXDATA 1 uint16_t*
57 TIFFTAG_COLORMAP 3 const uint16_t** 1<<BitsPerSample arrays
58 TIFFTAG_COMPRESSION 1 uint16_t*
59 TIFFTAG_CONSECUTIVEBADFAXLINES 1 uint32_t*
60 TIFFTAG_COPYRIGHT 1 const char**
61 TIFFTAG_DATATYPE 1 uint16_t*
62 TIFFTAG_DATETIME 1 const char**
63 TIFFTAG_DOCUMENTNAME 1 const char**
64 TIFFTAG_DOTRANGE 2 uint16_t*
65 TIFFTAG_EXTRASAMPLES 2 uint16_t*,const uint16_t**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_t*
69 TIFFTAG_GROUP3OPTIONS 1 uint32_t*
70 TIFFTAG_GROUP4OPTIONS 1 uint32_t*
71 TIFFTAG_HALFTONEHINTS 2 uint16_t*
72 TIFFTAG_HOSTCOMPUTER 1 const char**
73 TIFFTAG_ICCPROFILE 2 const uint32_t*,const void**count, profile data
74 TIFFTAG_IMAGEDEPTH 1 uint32_t*
75 TIFFTAG_IMAGEDESCRIPTION 1 const char**
76 TIFFTAG_IMAGELENGTH 1 uint32_t*
77 TIFFTAG_IMAGEWIDTH 1 uint32_t*
78 TIFFTAG_INKNAMES 1 const char**
79 TIFFTAG_INKSET 1 uint16_t*
80 TIFFTAG_JPEGCOLORMODE 1 int* JPEG pseudo-tag
81 TIFFTAG_JPEGQUALITY 1 int* JPEG pseudo-tag
82 TIFFTAG_JPEGTABLES 2 uint32_t*,const void**count & tables
83 TIFFTAG_JPEGTABLESMODE 1 int* JPEG pseudo-tag
84 TIFFTAG_MAKE 1 const char**
85 TIFFTAG_MATTEING 1 uint16_t*
86 TIFFTAG_MAXSAMPLEVALUE 1 uint16_t*
87 TIFFTAG_MINSAMPLEVALUE 1 uint16_t*
88 TIFFTAG_MODEL 1 const char**
89 TIFFTAG_ORIENTATION 1 uint16_t*
90 TIFFTAG_PAGENAME 1 const char**
91 TIFFTAG_PAGENUMBER 2 uint16_t*
92 TIFFTAG_PHOTOMETRIC 1 uint16_t*
93 TIFFTAG_PHOTOSHOP 2 uint32_t*,const void**count, data
94 TIFFTAG_PLANARCONFIG 1 uint16_t*
95 TIFFTAG_PREDICTOR 1 uint16_t*
96 TIFFTAG_PRIMARYCHROMATICITIES 1 const float** 6-entry array
97 TIFFTAG_REFERENCEBLACKWHITE 1 const float** 6-entry array
98 TIFFTAG_RESOLUTIONUNIT 1 uint16_t*
99 TIFFTAG_RICHTIFFIPTC 2 uint32_t*,const void**count, data
100 TIFFTAG_ROWSPERSTRIP 1 uint32_t*
101 TIFFTAG_SAMPLEFORMAT 1 uint16_t*
102 TIFFTAG_SAMPLESPERPIXEL 1 uint16_t*
103 TIFFTAG_SMAXSAMPLEVALUE 1 double*
104 TIFFTAG_SMINSAMPLEVALUE 1 double*
105 TIFFTAG_SOFTWARE 1 const char**
106 TIFFTAG_STONITS 1 const double**
107 TIFFTAG_STRIPBYTECOUNTS 1 const uint64_t**
108 TIFFTAG_STRIPOFFSETS 1 const uint64_t**
109 TIFFTAG_SUBFILETYPE 1 uint32_t*
110 TIFFTAG_SUBIFD 2 uint16_t*,const uint64_t**count & offsets array
111 TIFFTAG_TARGETPRINTER 1 const char**
112 TIFFTAG_THRESHHOLDING 1 uint16_t*
113 TIFFTAG_TILEBYTECOUNTS 1 const uint64_t**
114 TIFFTAG_TILEDEPTH 1 uint32_t*
115 TIFFTAG_TILELENGTH 1 uint32_t*
116 TIFFTAG_TILEOFFSETS 1 const uint64_t**
117 TIFFTAG_TILEWIDTH 1 uint32_t*
118 TIFFTAG_TRANSFERFUNCTION 1 or 3† const uint16_t**1<<BitsPerSample entry arrays
119 TIFFTAG_WHITEPOINT 1 const float** 2-entry array
120 TIFFTAG_XMLPACKET 2 uint32_t*,const void**count, data
121 TIFFTAG_XPOSITION 1 float*
122 TIFFTAG_XRESOLUTION 1 float*
123 TIFFTAG_YCBCRCOEFFICIENTS 1 const float** 3-entry array
124 TIFFTAG_YCBCRPOSITIONING 1 uint16_t*
125 TIFFTAG_YCBCRSUBSAMPLING 2 uint16_t*
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 an un‐
136 supported tag and is not directly supported by libtiff(3TIFF) library.
137 You will still be able to read it's value if you know the data type of
138 that tag. For example, if you want to read the LONG value from the tag
139 33424 and ASCII string from the tag 36867 you can use the following
140 code:
141
142 uint32_t count;
143 void *data;
144
145 TIFFGetField(tiff, 33424, &count, &data);
146 printf("Tag %d: %d, count %d0, 33424, *(uint32_t *)data, count);
147 TIFFGetField(tiff, 36867, &count, &data);
148 printf("Tag %d: %s, count %d0, 36867, (char *)data, count);
149
151 1 is returned if the tag is defined in the current directory; otherwise
152 a 0 is returned.
153
155 All error messages are directed to the TIFFError(3TIFF) routine.
156
157 Unknown field, tag 0x%x. An unknown tag was supplied.
158
160 TIFFOpen(3TIFF), TIFFSetField(3TIFF), TIFFSetDirectory(3TIFF), TIFF‐
161 ReadDirectory(3TIFF), TIFFWriteDirectory(3TIFF) libtiff(3TIFF),
162
163 Libtiff library home page: http://www.simplesystems.org/libtiff/
164
165
166
167libtiff March 29, 2020 TIFFGetField(3TIFF)