Debian Codegraph @

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

raw
1 TIFFSetField
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 TIFFSetField(TIFF* tif, ttag_t tag, ...)
15
16 .. c:function:: int TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
17
18 .. c:function:: int TIFFUnsetField(TIFF* tif, uint32_t tag)
19
20 Description
21 -----------
22
23 :c:func:`TIFFSetField` sets the value of a field or pseudo-tag in the
24 current directory associated with the open TIFF file *tif*.
25 (A *pseudo-tag* is a parameter that is used to control the operation of
26 the TIFF library but whose value is not read or written to the underlying
27 file.) To set the value of a field the file must have been previously
28 opened for writing with :c:func:`TIFFOpen`.
29 Pseudo-tags can be set whether the file was opened for reading or writing.
30 The field is identified by *tag*, one of the values defined in the include
31 file :file:`tiff.h` (see also the table below).
32 The actual value is specified using a variable argument list, as
33 prescribed by the :file:`stdarg.h` interface.
34
35 :c:func:`TIFFVSetField` is functionally equivalent to :c:func:`TIFFSetField`
36 except that it takes a pointer to a variable argument list.
37 :c:func:`TIFFVSetField` is useful for writing routines that are layered on
38 top of the functionality provided by :c:func:`TIFFSetField`.
39
40 :c:func:`TIFFUnsetField` clears the contents of the field in the internal
41 structure. If it is a custom field, it is removed from the list of known tags.
42
43 The tags understood by :program:`libtiff`, the number of parameter values,
44 and the expected types for the parameter values are shown below.
45 The data types are:
46
47 .. list-table:: Tag data types
48 :widths: 5 15
49 :header-rows: 1
50
51 * - Type
52 - Description
53
54 * - :c:expr:`char*`
55 - a null-terminated string corresponding to the ``ASCII`` data type
56 * - :c:expr:`uint16_t`
57 - an unsigned 16-bit value
58 * - :c:expr:`uint32_t`
59 - an unsigned 32-bit value;
60 * - :c:expr:`uint16_t*`
61 - an array of unsigned 16-bit values.
62 * - :c:expr:`void*`
63 - an array of data values of unspecified type.
64
65 Consult the TIFF specification for information on the meaning of each tag.
66
67 .. list-table:: Tag properties
68 :widths: 5 3 5 10
69 :header-rows: 1
70
71 * - Tag name
72 - Count
73 - Types
74 - Notes
75
76
77 * - :c:macro:`TIFFTAG_ARTIST`
78 - 1
79 - :c:expr:`char*`
80 -
81 * - :c:macro:`TIFFTAG_BADFAXLINES`
82 - 1
83 - :c:expr:`uint32_t`
84 -
85 * - :c:macro:`TIFFTAG_BITSPERSAMPLE`
86 - 1
87 - :c:expr:`uint16_t`
88 - †
89 * - :c:macro:`TIFFTAG_CLEANFAXDATA`
90 - 1
91 - :c:expr:`uint16_t`
92 -
93 * - :c:macro:`TIFFTAG_COLORMAP`
94 - 3
95 - :c:expr:`uint16_t*`
96 - :c:expr:`1<<BitsPerSample` arrays
97 * - :c:macro:`TIFFTAG_COMPRESSION`
98 - 1
99 - :c:expr:`uint16_t`
100 - †
101 * - :c:macro:`TIFFTAG_CONSECUTIVEBADFAXLINES`
102 - 1
103 - :c:expr:`uint32_t`
104 -
105 * - :c:macro:`TIFFTAG_COPYRIGHT`
106 - 1
107 - :c:expr:`char*`
108 -
109 * - :c:macro:`TIFFTAG_DATETIME`
110 - 1
111 - :c:expr:`char*`
112 -
113 * - :c:macro:`TIFFTAG_DOCUMENTNAME`
114 - 1
115 - :c:expr:`char*`
116 -
117 * - :c:macro:`TIFFTAG_DOTRANGE`
118 - 2
119 - :c:expr:`uint16_t`
120 -
121 * - :c:macro:`TIFFTAG_EXTRASAMPLES`
122 - 2
123 - :c:expr:`uint16_t`, :c:expr:`uint16_t*`
124 - † count, types array
125 * - :c:macro:`TIFFTAG_FAXFILLFUNC`
126 - 1
127 - :c:expr:`TIFFFaxFillFunc`
128 - G3/G4 compression pseudo-tag
129 * - :c:macro:`TIFFTAG_FAXMODE`
130 - 1
131 - :c:expr:`int`
132 - † G3/G4 compression pseudo-tag
133 * - :c:macro:`TIFFTAG_FILLORDER`
134 - 1
135 - :c:expr:`uint16_t`
136 - †
137 * - :c:macro:`TIFFTAG_GROUP3OPTIONS`
138 - 1
139 - :c:expr:`uint32_t`
140 - †
141 * - :c:macro:`TIFFTAG_GROUP4OPTIONS`
142 - 1
143 - :c:expr:`uint32_t`
144 - †
145 * - :c:macro:`TIFFTAG_HALFTONEHINTS`
146 - 2
147 - :c:expr:`uint16_t`
148 -
149 * - :c:macro:`TIFFTAG_HOSTCOMPUTER`
150 - 1
151 - :c:expr:`char*`
152 -
153 * - :c:macro:`TIFFTAG_ICCPROFILE`
154 - 2
155 - :c:expr:`uint32_t`, :c:expr:`void*`
156 - count, profile data*
157 * - :c:macro:`TIFFTAG_IMAGEDEPTH`
158 - 1
159 - :c:expr:`uint32_t`
160 - †
161 * - :c:macro:`TIFFTAG_IMAGEDESCRIPTION`
162 - 1
163 - :c:expr:`char*`
164 -
165 * - :c:macro:`TIFFTAG_IMAGELENGTH`
166 - 1
167 - :c:expr:`uint32_t`
168 -
169 * - :c:macro:`TIFFTAG_IMAGEWIDTH`
170 - 1
171 - :c:expr:`uint32_t`
172 - †
173 * - :c:macro:`TIFFTAG_INKNAMES`
174 - 2
175 - :c:expr:`uint16_t`, :c:expr:`char*`
176 -
177 * - :c:macro:`TIFFTAG_INKSET`
178 - 1
179 - :c:expr:`uint16_t`
180 - †
181 * - :c:macro:`TIFFTAG_JPEGCOLORMODE`
182 - 1
183 - :c:expr:`int`
184 - † JPEG pseudo-tag
185 * - :c:macro:`TIFFTAG_JPEGQUALITY`
186 - 1
187 - :c:expr:`int`
188 - JPEG pseudo-tag
189 * - :c:macro:`TIFFTAG_JPEGTABLES`
190 - 2
191 - :c:expr:`uint32_t*`, :c:expr:`void*`
192 - † count, tables
193 * - :c:macro:`TIFFTAG_JPEGTABLESMODE`
194 - 1
195 - :c:expr:`int`
196 - † JPEG pseudo-tag
197 * - :c:macro:`TIFFTAG_MAKE`
198 - 1
199 - :c:expr:`char*`
200 -
201 * - :c:macro:`TIFFTAG_MATTEING`
202 - 1
203 - :c:expr:`uint16_t`
204 - †
205 * - :c:macro:`TIFFTAG_MAXSAMPLEVALUE`
206 - 1
207 - :c:expr:`uint16_t`
208 -
209 * - :c:macro:`TIFFTAG_MINSAMPLEVALUE`
210 - 1
211 - :c:expr:`uint16_t`
212 -
213 * - :c:macro:`TIFFTAG_MODEL`
214 - 1
215 - :c:expr:`char*`
216 -
217 * - :c:macro:`TIFFTAG_ORIENTATION`
218 - 1
219 - :c:expr:`uint16_t`
220 -
221 * - :c:macro:`TIFFTAG_PAGENAME`
222 - 1
223 - :c:expr:`char*`
224 -
225 * - :c:macro:`TIFFTAG_PAGENUMBER`
226 - 2
227 - :c:expr:`uint16_t`
228 -
229 * - :c:macro:`TIFFTAG_PHOTOMETRIC`
230 - 1
231 - :c:expr:`uint16_t`
232 -
233 * - :c:macro:`TIFFTAG_PHOTOSHOP`
234 - ?
235 - :c:expr:`uint32_t`, :c:expr:`void*`
236 - count, data
237 * - :c:macro:`TIFFTAG_PLANARCONFIG`
238 - 1
239 - :c:expr:`uint16_t`
240 - †
241 * - :c:macro:`TIFFTAG_PREDICTOR`
242 - 1
243 - :c:expr:`uint16_t`
244 - †
245 * - :c:macro:`TIFFTAG_PRIMARYCHROMATICITIES`
246 - 1
247 - :c:expr:`float*`
248 - 6-entry array
249 * - :c:macro:`TIFFTAG_REFERENCEBLACKWHITE`
250 - 1
251 - :c:expr:`float*`
252 - † 6-entry array
253 * - :c:macro:`TIFFTAG_RESOLUTIONUNIT`
254 - 1
255 - :c:expr:`uint16_t`
256 -
257 * - :c:macro:`TIFFTAG_RICHTIFFIPTC`
258 - 2
259 - :c:expr:`uint32_t`, :c:expr:`void*`
260 - count, data
261 * - :c:macro:`TIFFTAG_ROWSPERSTRIP`
262 - 1
263 - :c:expr:`uint32_t`
264 - † must be > 0
265 * - :c:macro:`TIFFTAG_SAMPLEFORMAT`
266 - 1
267 - :c:expr:`uint16_t`
268 - †
269 * - :c:macro:`TIFFTAG_SAMPLESPERPIXEL`
270 - 1
271 - :c:expr:`uint16_t`
272 - † value must be ≤ 4
273 * - :c:macro:`TIFFTAG_SMAXSAMPLEVALUE`
274 - 1
275 - :c:expr:`double`
276 -
277 * - :c:macro:`TIFFTAG_SMINSAMPLEVALUE`
278 - 1
279 - :c:expr:`double`
280 -
281 * - :c:macro:`TIFFTAG_SOFTWARE`
282 - 1
283 - :c:expr:`char*`
284 -
285 * - :c:macro:`TIFFTAG_STONITS`
286 - 1
287 - :c:expr:`double`
288 - †
289 * - :c:macro:`TIFFTAG_SUBFILETYPE`
290 - 1
291 - :c:expr:`uint32_t`
292 -
293 * - :c:macro:`TIFFTAG_SUBIFD`
294 - 2
295 - :c:expr:`uint16_t`, :c:expr:`uint64_t*`
296 - count, offsets array
297 * - :c:macro:`TIFFTAG_TARGETPRINTER`
298 - 1
299 - :c:expr:`char*`
300 -
301 * - :c:macro:`TIFFTAG_THRESHHOLDING`
302 - 1
303 - :c:expr:`uint16_t`
304 -
305 * - :c:macro:`TIFFTAG_TILEDEPTH`
306 - 1
307 - :c:expr:`uint32_t`
308 - †
309 * - :c:macro:`TIFFTAG_TILELENGTH`
310 - 1
311 - :c:expr:`uint32_t`
312 - † must be a multiple of 8
313 * - :c:macro:`TIFFTAG_TILEWIDTH`
314 - 1
315 - :c:expr:`uint32_t`
316 - † must be a multiple of 8
317 * - :c:macro:`TIFFTAG_TRANSFERFUNCTION`
318 - 1 or 3‡
319 - :c:expr:`uint16_t*`
320 - :c:expr:`1<<BitsPerSample` entry arrays
321 * - :c:macro:`TIFFTAG_WHITEPOINT`
322 - 1
323 - :c:expr:`float*`
324 - 2-entry array
325 * - :c:macro:`TIFFTAG_XMLPACKET`
326 - 2
327 - :c:expr:`uint32_t`, :c:expr:`void*`
328 - count, data
329 * - :c:macro:`TIFFTAG_XPOSITION`
330 - 1
331 - :c:expr:`float`
332 -
333 * - :c:macro:`TIFFTAG_XRESOLUTION`
334 - 1
335 - :c:expr:`float`
336 -
337 * - :c:macro:`TIFFTAG_YCBCRCOEFFICIENTS`
338 - 1
339 - :c:expr:`float*`
340 - † 3-entry array
341 * - :c:macro:`TIFFTAG_YCBCRPOSITIONING`
342 - 1
343 - :c:expr:`uint16_t`
344 - †
345 * - :c:macro:`TIFFTAG_YCBCRSAMPLING`
346 - 2
347 - :c:expr:`uint16_t`
348 - †
349 * - :c:macro:`TIFFTAG_YPOSITION`
350 - 1
351 - :c:expr:`float`
352 -
353 * - :c:macro:`TIFFTAG_YRESOLUTION`
354 - 1
355 - :c:expr:`float`
356 -
357
358 †:
359 Tag may not have its values changed once data is written.
360
361 ‡:
362
363 If ``SamplesPerPixel`` is one, then a single array is passed;
364 otherwise three arrays should be passed.
365
366 \*:
367 The contents of this field are quite complex. See
368 "The ICC Profile Format Specification",
369 Annex B.3 "Embedding ICC Profiles in TIFF Files"
370 (available at http://www.color.org) for an explanation.
371
372 Return values
373 -------------
374
375 1 is returned if the operation was successful.
376 Otherwise, 0 is returned if an error was detected.
377
378 Diagnostics
379 -----------
380
381 All error messages are directed to the :c:func:`TIFFErrorExtR` routine.
382
383 ``%s: Cannot modify tag "%s" while writing``:
384
385 Data has already been written to the file, so the
386 specified tag's value can not be changed.
387 This restriction is applied to all tags that affect
388 the format of written data.
389
390 ``%d: Bad value for "%s"``:
391
392 An invalid value was supplied for the named tag.
393
394 See also
395 --------
396
397 :doc:`TIFFOpen` (3tiff),
398 :doc:`TIFFGetField` (3tiff),
399 :doc:`TIFFSetDirectory` (3tiff),
400 :doc:`TIFFWriteDirectory` (3tiff),
401 :doc:`TIFFReadDirectory` (3tiff),
402 :doc:`libtiff` (3tiff)