Debian Codegraph @

texk/xdvipsk/thirdparty/libtiff/doc/functions/TIFFGetField.rst

raw
1 TIFFGetField
2 ============
3
4 Synopsis
5 --------
6
7 .. highlight:: c
8
9 ::
10
11 #include <tiffio.h>
12 #include <stdarg.h>
13
14 .. c:function:: int TIFFGetField(TIFF* tif, ttag_t tag, ...)
15
16 .. c:function:: int TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
17
18 .. c:function:: int TIFFGetFieldDefaulted(TIFF* tif, ttag_t tag, ...)
19
20 .. c:function:: int TIFFVGetFieldDefaulted(TIFF* tif, ttag_t tag, va_list ap)
21
22 Description
23 -----------
24
25 :c:func:`TIFFGetField` returns the value of a tag or pseudo-tag associated with the
26 the current directory of the opened TIFF file *tif*. (A *pseudo-tag* is a
27 parameter that is used to control the operation of the TIFF library but whose value
28 is not read or written to the underlying file.) The file must have been previously
29 opened with :c:func:`TIFFOpen`. The tag is identified by *tag*, one of the values
30 defined in the include file :file:`tiff.h` (see also the table below). The type and
31 number of values returned is dependent on the tag being requested. The programming
32 interface uses a variable argument list as prescribed by the :file:`stdarg.h`
33 interface. The returned values should only be interpreted if :c:func:`TIFFGetField`
34 returns 1.
35
36 :c:func:`TIFFVGetField` is functionally equivalent to :c:func:`TIFFGetField`
37 except that it takes a pointer to a variable argument list. :c:func:`TIFFVGetField`
38 is useful for layering interfaces on top of the functionality provided by
39 :c:func:`TIFFGetField`.
40
41 :c:func:`TIFFGetFieldDefaulted` and :c:func:`TIFFVGetFieldDefaulted` are identical
42 to :c:func:`TIFFGetField` and :c:func:`TIFFVGetField`, respectively, except that if
43 a tag is not defined in the current directory and it has a default value, then the
44 default value is returned.
45
46 The tags understood by :program:`libtiff` the number of parameter values, and the
47 types for the returned values are shown below. The data types are specified as in C
48 and correspond to the types used to specify tag values to
49 :c:func:`TIFFSetField`. Remember that :c:func:`TIFFGetField` returns parameter
50 values, so all the listed data types are pointers to storage where values should be
51 returned. Consult the TIFF specification (or relevant industry specification) for
52 information on the meaning of each tag and their possible values.
53
54 .. list-table:: Tag properties
55 :widths: 5 3 5 10
56 :header-rows: 1
57
58 * - Tag name
59 - Count
60 - Types
61 - Notes
62
63 * - :c:macro:`TIFFTAG_ARTIST`
64 - 1
65 - :c:expr:`const char**`
66 -
67
68 * - :c:macro:`TIFFTAG_BADFAXLINES`
69 - 1
70 - :c:expr:`uint32_t*`
71 -
72
73 * - :c:macro:`TIFFTAG_BITSPERSAMPLE`
74 - 1
75 - :c:expr:`uint16_t*`
76 -
77
78 * - :c:macro:`TIFFTAG_CLEANFAXDATA`
79 - 1
80 - :c:expr:`uint16_t*`
81 -
82
83 * - :c:macro:`TIFFTAG_COLORMAP`
84 - 3
85 - :c:expr:`const uint16_t**`
86 - :c:expr:`1<<BitsPerSample` arrays
87
88 * - :c:macro:`TIFFTAG_COMPRESSION`
89 - 1
90 - :c:expr:`uint16_t*`
91 -
92
93 * - :c:macro:`TIFFTAG_CONSECUTIVEBADFAXLINES`
94 - 1
95 - :c:expr:`uint32_t*`
96 -
97
98 * - :c:macro:`TIFFTAG_COPYRIGHT`
99 - 1
100 - :c:expr:`const char**`
101 -
102
103 * - :c:macro:`TIFFTAG_DATATYPE`
104 - 1
105 - :c:expr:`uint16_t*`
106 -
107
108 * - :c:macro:`TIFFTAG_DATETIME`
109 - 1
110 - :c:expr:`const char**`
111 -
112
113 * - :c:macro:`TIFFTAG_DOCUMENTNAME`
114 - 1
115 - :c:expr:`const char**`
116 -
117
118 * - :c:macro:`TIFFTAG_DOTRANGE`
119 - 2
120 - :c:expr:`uint16_t*`
121 -
122
123 * - :c:macro:`TIFFTAG_EXTRASAMPLES`
124 - 2
125 - :c:expr:`uint16_t*`, :c:expr:`const uint16_t**`
126 - count, types array
127
128 * - :c:macro:`TIFFTAG_FAXFILLFUNC`
129 - 1
130 - :c:expr:`TIFFFaxFillFunc*`
131 - G3/G4 compression pseudo-tag
132
133 * - :c:macro:`TIFFTAG_FAXMODE`
134 - 1
135 - :c:expr:`int*`
136 - G3/G4 compression pseudo-tag
137
138 * - :c:macro:`TIFFTAG_FILLORDER`
139 - 1
140 - :c:expr:`uint16_t*`
141 -
142
143 * - :c:macro:`TIFFTAG_GROUP3OPTIONS`
144 - 1
145 - :c:expr:`uint32_t*`
146 -
147
148 * - :c:macro:`TIFFTAG_GROUP4OPTIONS`
149 - 1
150 - :c:expr:`uint32_t*`
151 -
152
153 * - :c:macro:`TIFFTAG_HALFTONEHINTS`
154 - 2
155 - :c:expr:`uint16_t*`
156 -
157
158 * - :c:macro:`TIFFTAG_HOSTCOMPUTER`
159 - 1
160 - :c:expr:`const char**`
161 -
162
163 * - :c:macro:`TIFFTAG_ICCPROFILE`
164 - 2
165 - :c:expr:`const uint32_t*`, :c:expr:`const void**`
166 - count, profile data‡
167
168 * - :c:macro:`TIFFTAG_IMAGEDEPTH`
169 - 1
170 - :c:expr:`uint32_t*`
171 -
172
173 * - :c:macro:`TIFFTAG_IMAGEDESCRIPTION`
174 - 1
175 - :c:expr:`const char**`
176 -
177
178 * - :c:macro:`TIFFTAG_IMAGELENGTH`
179 - 1
180 - :c:expr:`uint32_t*`
181 -
182
183 * - :c:macro:`TIFFTAG_IMAGEWIDTH`
184 - 1
185 - :c:expr:`uint32_t*`
186 -
187
188 * - :c:macro:`TIFFTAG_INKNAMES`
189 - 1
190 - :c:expr:`const char**`
191 -
192
193 * - :c:macro:`TIFFTAG_INKSET`
194 - 1
195 - :c:expr:`uint16_t*`
196 -
197
198 * - :c:macro:`TIFFTAG_JPEGCOLORMODE`
199 - 1
200 - :c:expr:`int*`
201 - JPEG pseudo-tag
202
203 * - :c:macro:`TIFFTAG_JPEGQUALITY`
204 - 1
205 - :c:expr:`int*`
206 - JPEG pseudo-tag
207
208 * - :c:macro:`TIFFTAG_JPEGTABLES`
209 - 2
210 - :c:expr:`uint32_t*`, :c:expr:`const void**`
211 - count, tables
212
213 * - :c:macro:`TIFFTAG_JPEGTABLESMODE`
214 - 1
215 - :c:expr:`int*`
216 - JPEG pseudo-tag
217
218 * - :c:macro:`TIFFTAG_MAKE`
219 - 1
220 - :c:expr:`const char**`
221 -
222
223 * - :c:macro:`TIFFTAG_MATTEING`
224 - 1
225 - :c:expr:`uint16_t*`
226 -
227
228 * - :c:macro:`TIFFTAG_MAXSAMPLEVALUE`
229 - 1
230 - :c:expr:`uint16_t*`
231 -
232
233 * - :c:macro:`TIFFTAG_MINSAMPLEVALUE`
234 - 1
235 - :c:expr:`uint16_t*`
236 -
237
238 * - :c:macro:`TIFFTAG_MODEL`
239 - 1
240 - :c:expr:`const char**`
241 -
242
243 * - :c:macro:`TIFFTAG_ORIENTATION`
244 - 1
245 - :c:expr:`uint16_t*`
246 -
247
248 * - :c:macro:`TIFFTAG_PAGENAME`
249 - 1
250 - :c:expr:`const char**`
251 -
252
253 * - :c:macro:`TIFFTAG_PAGENUMBER`
254 - 2
255 - :c:expr:`uint16_t*`
256 -
257
258 * - :c:macro:`TIFFTAG_PHOTOMETRIC`
259 - 1
260 - :c:expr:`uint16_t*`
261 -
262
263 * - :c:macro:`TIFFTAG_PHOTOSHOP`
264 - 2
265 - :c:expr:`uint32_t*`, :c:expr:`const void**`
266 - count, data
267
268 * - :c:macro:`TIFFTAG_PLANARCONFIG`
269 - 1
270 - :c:expr:`uint16_t*`
271 -
272
273 * - :c:macro:`TIFFTAG_PREDICTOR`
274 - 1
275 - :c:expr:`uint16_t*`
276 -
277
278 * - :c:macro:`TIFFTAG_PRIMARYCHROMATICITIES`
279 - 1
280 - :c:expr:`const float**`
281 - 6-entry array
282
283 * - :c:macro:`TIFFTAG_REFERENCEBLACKWHITE`
284 - 1
285 - :c:expr:`const float**`
286 - 6-entry array
287
288 * - :c:macro:`TIFFTAG_RESOLUTIONUNIT`
289 - 1
290 - :c:expr:`uint16_t*`
291 -
292
293 * - :c:macro:`TIFFTAG_RICHTIFFIPTC`
294 - 2
295 - :c:expr:`uint32_t*`, :c:expr:`const void**`
296 - count, data
297
298 * - :c:macro:`TIFFTAG_ROWSPERSTRIP`
299 - 1
300 - :c:expr:`uint32_t*`
301 -
302
303 * - :c:macro:`TIFFTAG_SAMPLEFORMAT`
304 - 1
305 - :c:expr:`uint16_t*`
306 -
307
308 * - :c:macro:`TIFFTAG_SAMPLESPERPIXEL`
309 - 1
310 - :c:expr:`uint16_t*`
311 -
312
313 * - :c:macro:`TIFFTAG_SMAXSAMPLEVALUE`
314 - 1
315 - :c:expr:`double*`
316 -
317
318 * - :c:macro:`TIFFTAG_SMINSAMPLEVALUE`
319 - 1
320 - :c:expr:`double*`
321 -
322
323 * - :c:macro:`TIFFTAG_SOFTWARE`
324 - 1
325 - :c:expr:`const char**`
326 -
327
328 * - :c:macro:`TIFFTAG_STONITS`
329 - 1
330 - :c:expr:`double*`
331 -
332
333 * - :c:macro:`TIFFTAG_STRIPBYTECOUNTS`
334 - 1
335 - :c:expr:`const uint64_t**`
336 -
337
338 * - :c:macro:`TIFFTAG_STRIPOFFSETS`
339 - 1
340 - :c:expr:`const uint64_t**`
341 -
342
343 * - :c:macro:`TIFFTAG_SUBFILETYPE`
344 - 1
345 - :c:expr:`uint32_t*`
346 -
347
348 * - :c:macro:`TIFFTAG_SUBIFD`
349 - 2
350 - :c:expr:`uint16_t*`, :c:expr:`const uint64_t**`
351 - count, offsets array
352
353 * - :c:macro:`TIFFTAG_TARGETPRINTER`
354 - 1
355 - :c:expr:`const char**`
356 -
357
358 * - :c:macro:`TIFFTAG_THRESHHOLDING`
359 - 1
360 - :c:expr:`uint16_t*`
361 -
362
363 * - :c:macro:`TIFFTAG_TILEBYTECOUNTS`
364 - 1
365 - :c:expr:`const uint64_t**`
366 -
367
368 * - :c:macro:`TIFFTAG_TILEDEPTH`
369 - 1
370 - :c:expr:`uint32_t*`
371 -
372
373 * - :c:macro:`TIFFTAG_TILELENGTH`
374 - 1
375 - :c:expr:`uint32_t*`
376 -
377
378 * - :c:macro:`TIFFTAG_TILEOFFSETS`
379 - 1
380 - :c:expr:`const uint64_t**`
381 -
382
383 * - :c:macro:`TIFFTAG_TILEWIDTH`
384 - 1
385 - :c:expr:`uint32_t*`
386 -
387
388 * - :c:macro:`TIFFTAG_TRANSFERFUNCTION`
389 - 1 or 3†
390 - :c:expr:`const uint16_t**`
391 - :c:expr:`1<<BitsPerSample` entry arrays
392
393 * - :c:macro:`TIFFTAG_WHITEPOINT`
394 - 1
395 - :c:expr:`const float**`
396 - 2-entry array
397
398 * - :c:macro:`TIFFTAG_XMLPACKET`
399 - 2
400 - :c:expr:`uint32_t*`, :c:expr:`const void**`
401 - count, data
402
403 * - :c:macro:`TIFFTAG_XPOSITION`
404 - 1
405 - :c:expr:`float*`
406 -
407
408 * - :c:macro:`TIFFTAG_XRESOLUTION`
409 - 1
410 - :c:expr:`float*`
411 -
412
413 * - :c:macro:`TIFFTAG_YCBCRCOEFFICIENTS`
414 - 1
415 - :c:expr:`const float**`
416 - 3-entry array
417
418 * - :c:macro:`TIFFTAG_YCBCRPOSITIONING`
419 - 1
420 - :c:expr:`uint16_t*`
421 -
422
423 * - :c:macro:`TIFFTAG_YCBCRSUBSAMPLING`
424 - 2
425 - :c:expr:`uint16_t*`
426 -
427
428 * - :c:macro:`TIFFTAG_YPOSITION`
429 - 1
430 - :c:expr:`float*`
431 -
432
433 * - :c:macro:`TIFFTAG_YRESOLUTION`
434 - 1
435 - :c:expr:`float*`
436 -
437
438 †:
439 If ``SamplesPerPixel`` is one, then a single array is returned; otherwise
440 three arrays are returned.
441
442 ‡:
443 The contents of this field are quite complex. See
444 "The ICC Profile Format Specification",
445 Annex B.3 "Embedding ICC Profiles in TIFF Files" (available at
446 http://www.color.org) for an explanation.
447
448 Autoregistered tags
449 -------------------
450
451 If you can't find the tag in the table above that means this is an unsupported
452 tag and is not directly supported by the :program:`libtiff` library. You will
453 still be able to read it's value if you know the data type of that tag. For
454 example, if you want to read the ``LONG`` value from the tag 33424
455 and ``ASCII`` string from the tag 36867 you can use the following code:
456
457 ::
458
459 uint32_t count;
460 void *data;
461
462 TIFFGetField(tiff, 33424, &count, &data);
463 printf("Tag %d: %d, count %d\n", 33424, *(uint32_t *)data, count);
464 TIFFGetField(tiff, 36867, &count, &data);
465 printf("Tag %d: %s, count %d\n", 36867, (char *)data, count);
466
467 Return values
468 -------------
469
470 1 is returned if the tag is defined in the current directory; otherwise a 0 is
471 returned.
472
473 Diagnostics
474 -----------
475
476 All error messages are directed to the :c:func:`TIFFErrorExtR` routine.
477
478 ``Unknown field, tag 0x%x``:
479
480 An unknown tag was supplied.
481
482 See also
483 --------
484
485 :doc:`TIFFOpen` (3tiff),
486 :doc:`TIFFSetField` (3tiff),
487 :doc:`TIFFSetDirectory` (3tiff),
488 :doc:`TIFFReadDirectory` (3tiff),
489 :doc:`TIFFWriteDirectory` (3tiff),
490 :doc:`libtiff` (3tiff)