Debian Codegraph @

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

raw
1 libtiff
2 =======
3
4 Synopsis
5 --------
6
7 .. highlight:: c
8
9 ::
10
11 #include <tiffio.h>
12
13 .. highlight:: shell
14
15 ::
16
17 cc file.c -ltiff
18
19 Description
20 -----------
21
22 :program:`libtiff` is a library for reading and writing data files encoded with the
23 *"Tag Image File"* format, Revision 6.0 (or revision 5.0 or revision 4.0). This file
24 format is suitable for archiving multi-color and monochromatic image data.
25
26 The library supports several compression algorithms, as indicated by the
27 ``Compression`` field, including:
28 no compression (1),
29 CCITT 1D Huffman compression (2),
30 CCITT Group 3 Facsimile compression (3),
31 CCITT Group 4 Facsimile compression (4),
32 Lempel-Ziv & Welch compression (5),
33 baseline JPEG compression (7),
34 word-aligned 1D Huffman compression (32771),
35 PackBits compression (32773).
36 In addition, several nonstandard compression algorithms are supported: the
37 4-bit compression algorithm used by the
38 *ThunderScan* program (32809) (decompression only),
39 NeXT's 2-bit compression algorithm (32766) (decompression only),
40 an experimental LZ-style algorithm known as Deflate (32946),
41 and an experimental CIE LogLuv compression scheme designed
42 for images with high dynamic range (32845 for LogL and 32845 for LogLuv).
43 Directory information may be in either little- or big-endian byte order; byte
44 swapping is automatically done by the library. Data bit ordering may be either
45 Most Significant Bit (``MSB``) to Least Significant Bit (``LSB``) or
46 LSB to MSB.
47 Finally, the library does not support files in which the
48 ``BitsPerSample`` ,
49 ``Compression`` ,
50 ``MinSampleValue`` ,
51 or
52 ``MaxSampleValue``
53 fields are defined differently on a per-sample basis
54 (in Rev. 6.0 the
55 ``Compression``
56 tag is not defined on a per-sample basis, so this is immaterial).
57
58 Data types
59 ----------
60
61 The library makes extensive use of C typedefs to promote portability.
62 Two sets of typedefs are used, one for communication with clients
63 of the library and one for internal data structures and parsing of the
64 TIFF format.
65 The following typedefs are exposed to users either through function
66 definitions or through parameters passed through the varargs interfaces.
67
68 .. highlight:: c
69
70 ::
71
72 typedef uint32_t ttag_t; // directory tag
73 typedef uint32_t tdir_t; // directory index
74 typedef uint16_t tsample_t; // sample number
75 typedef uint32_t tstrip_t; // strip number
76 typedef uint32_t ttile_t; // tile number
77 typedef int64_t tmsize_t; // signed size type (int32_t on 32-bit platforms)
78 typedef tmsize_t tsize_t; // i/o size in bytes
79 typedef void* tdata_t; // image data ref
80 typedef void* thandle_t; // client data handle
81 typedef uint64_t toff_t; // file offset
82
83 Note that
84 :c:type:`tstrip_t`,
85 :c:type:`ttile_t`,
86 and
87 :c:type:`tsize_t`
88 are constrained to be no more than 32-bit quantities by 32-bit fields they are
89 stored in in the
90 TIFF
91 image.
92 Likewise
93 :c:type:`tsample_t`
94 is limited by the 16-bit field used to store the
95 ``SamplesPerPixel``
96 tag.
97
98 :c:type:`tdir_t`
99 constrains the maximum number of
100 IFDs
101 that may appear in an image and may be an arbitrary size (w/o penalty).
102 Starting with libtiff 4.5.0, tdir_t is a 32-bit unsigned integer. Previously,
103 it was a 16-bit unsigned integer.
104
105 :c:type:`ttag_t`
106 must be either int, unsigned int, pointer, or double because the library uses
107 a varargs interface and
108 C restricts the type of the parameter before an ellipsis to be a promoted type.
109 :c:type:`toff_t`
110 is defined as :c:type:`uint64_t` because TIFF file offsets are (unsigned) 32-bit
111 quantities, and BigTIFF file offsets are unsigned 64-bit quantities.
112 A signed value is used because some interfaces return -1 on
113 error. Finally, note that user-specified data references are passed as opaque
114 handles and only cast at the lowest layers where their type is presumed.
115
116 .. TODO: Check why this toff_t was switched to unsigned and update description.
117
118 .. _List_of_routines:
119
120 List of routines
121 ----------------
122
123 The following routines are part of the library. Consult specific manual pages
124 for details on their operation; on most systems doing :command:`man function-name`
125 will work.
126
127 .. list-table:: *Libtiff functions*
128 :widths: 5 20
129 :header-rows: 1
130
131 * - Name
132 - Description
133 * - :c:func:`TIFFAccessTagMethods`
134 - provides read/write access to the TIFFTagMethods within the TIFF structure
135 to application code without giving access to the private TIFF structure
136 * - :c:func:`TIFFCheckpointDirectory`
137 - writes the current state of the directory
138 * - :c:func:`TIFFCheckTile`
139 - very x,y,z,sample is within image
140 * - :c:func:`TIFFCIELabToRGBInit`
141 - initialize CIE L*a*b* 1976 to RGB conversion state
142 * - :c:func:`TIFFCIELabToXYZ`
143 - perform CIE L*a*b* 1976 to CIE XYZ conversion
144 * - :c:func:`TIFFCleanup`
145 - auxiliary function to free the TIFF structure
146 * - :c:func:`TIFFClientdata`
147 - return open file's clientdata handle, which represents
148 the file descriptor used within ``libtiff``.
149 * - :c:func:`TIFFClientOpen`
150 - open a file for reading or writing
151 * - :c:func:`TIFFClientOpenExt`
152 - open a file for reading or writing with options,
153 such as re-entrant error and warning handlers may be passed
154 * - :c:func:`TIFFClose`
155 - close a previously opened TIFF file
156 * - :c:func:`TIFFComputeStrip`
157 - return strip containing y,sample
158 * - :c:func:`TIFFComputeTile`
159 - return tile containing x,y,z,sample
160 * - :c:func:`TIFFCreateCustomDirectory`
161 - setup for a *custom* directory in a open TIFF file
162 * - :c:func:`TIFFCreateDirectory`
163 - setup for a directory in a open TIFF file
164 * - :c:func:`TIFFCreateEXIFDirectory`
165 - setup for a *EXIF* custom directory in a open TIFF file within a TIFF tag
166 * - :c:func:`TIFFCreateGPSDirectory`
167 - setup for a *GPS* custom directory in a open TIFF file within a TIFF tag
168 * - :c:func:`TIFFCurrentDirectory`
169 - return index of current directory
170 * - :c:func:`TIFFCurrentDirOffset`
171 - return file offset of the current directory (instead of an index)
172 * - :c:func:`TIFFCurrentRow`
173 - return index of current scanline
174 * - :c:func:`TIFFCurrentStrip`
175 - return index of current strip
176 * - :c:func:`TIFFCurrentTile`
177 - return index of current tile
178 * - :c:func:`TIFFDataWidth`
179 - return the size of TIFF data types
180 * - :c:func:`TIFFDefaultStripSize`
181 - return number of rows for a reasonable-sized strip according to the
182 current settings of the ImageWidth, BitsPerSample and SamplesPerPixel,
183 tags and any compression-specific requirements
184 * - :c:func:`TIFFDefaultTileSize`
185 - return pixel width and height of a reasonable-sized tile;
186 suitable for setting up the TileWidth and TileLength tags
187 * - :c:func:`TIFFDeferStrileArrayWriting`
188 - is an advanced writing function to control when/where the
189 [Strip/Tile][Offsets/ByteCounts] arrays are written into the file,
190 and must be used in a particular sequence together with
191 TIFFForceStrileArrayWriting() (see description)
192 * - :c:func:`TIFFError`
193 - library-wide error handling function printing to ``stderr``
194 * - :c:func:`TIFFErrorExt`
195 - user-specific library-wide error handling function that can be passed
196 a file handle, which is set to the open TIFF file within ``libtiff``
197 * - :c:func:`TIFFErrorExtR`
198 - user-specific re-entrant library error handling function,
199 to which its TIFF structure is passed
200 containing the pointer to a user-specific data object
201 * - :c:func:`TIFFFdOpen`
202 - open a file for reading or writing
203 * - :c:func:`TIFFFdOpenExt`
204 - open a file for reading or writing with options,
205 such as re-entrant error and warning handlers may be passed
206 * - :c:func:`TIFFFieldDataType`
207 - get data type from field information
208 * - :c:func:`TIFFFieldIsAnonymous`
209 - returns if field was unknown to ``libtiff`` and has been auto-registered
210 * - :c:func:`TIFFFieldName`
211 - get field name from field information
212 * - :c:func:`TIFFFieldPassCount`
213 - get whether to pass a value count to Get/SetField
214 * - :c:func:`TIFFFieldReadCount`
215 - get number of values to be read from field
216 * - :c:func:`TIFFFieldSetGetCountSize`
217 - returns size of ``count`` parameter of :c:func:`TIFFSetField` and
218 :c:func:`TIFFGetField`
219 * - :c:func:`TIFFFieldSetGetSize`
220 - return data size in bytes of the field data type used for ``libtiff``
221 internal storage.
222 * - :c:func:`TIFFFieldTag`
223 - get tag value from field information
224 * - :c:func:`TIFFFieldWithName`
225 - get field information given field name
226 * - :c:func:`TIFFFieldWithTag`
227 - get field information given tag
228 * - :c:func:`TIFFFieldWriteCount`
229 - get number of values to be written to field
230 * - :c:func:`TIFFFileName`
231 - return name of open file
232 * - :c:func:`TIFFFileno`
233 - return open file descriptor
234 * - :c:func:`TIFFFindCODEC`
235 - find standard codec for the specific scheme
236 * - :c:func:`TIFFFindField`
237 - get field information given tag and data type
238 * - :c:func:`TIFFFlush`
239 - flush all pending writes
240 * - :c:func:`TIFFFlushData`
241 - flush pending data writes
242 * - :c:func:`TIFFForceStrileArrayWriting`
243 - is an advanced writing function that writes the
244 [Strip/Tile][Offsets/ByteCounts] arrays at the end of the file (see description)
245 * - :c:func:`TIFFFreeDirectory`
246 - release storage associated with a directory
247 * - :c:func:`TIFFGetBitRevTable`
248 - return bit reversal table
249 * - :c:func:`TIFFGetClientInfo`
250 - returns a pointer to the data of the named entry in the clientinfo-list
251 * - :c:func:`TIFFGetCloseProc`
252 - returns a pointer to file close method
253 * - :c:func:`TIFFGetConfiguredCODECs`
254 - gets list of configured codecs, both built-in and registered by user
255 * - :c:func:`TIFFGetField`
256 - return tag value in current directory
257 * - :c:func:`TIFFGetFieldDefaulted`
258 - return tag value in current directory with default value set if the
259 value is not already set and a default is defined
260 * - :c:func:`TIFFGetMapFileProc`
261 - returns a pointer to memory mapping method
262 * - :c:func:`TIFFGetMode`
263 - return open file mode
264 * - :c:func:`TIFFGetReadProc`
265 - returns a pointer to file read method
266 * - :c:func:`TIFFGetSeekProc`
267 - returns a pointer to file seek method
268 * - :c:func:`TIFFGetSizeProc`
269 - returns a pointer to file size requesting method
270 * - :c:func:`TIFFGetStrileByteCount`
271 - return value of the TileByteCounts/StripByteCounts array for the
272 specified tile/strile
273 * - :c:func:`TIFFGetStrileByteCountWithErr`
274 - same as `TIFFGetStrileByteCount()` and additionally provides an error return
275 * - :c:func:`TIFFGetStrileOffset`
276 - return value of the TileOffsets/StripOffsets array for the specified tile/strile
277 * - :c:func:`TIFFGetStrileOffsetWithErr`
278 - same as `TIFFGetStrileOffset()` and additionally provides an error return
279 * - :c:func:`TIFFGetTagListCount`
280 - return number of entries in the custom tag list
281 * - :c:func:`TIFFGetTagListEntry`
282 - return tag number of the (n.th - 1) entry within the custom tag list
283 * - :c:func:`TIFFGetUnmapFileProc`
284 - returns a pointer to memory unmapping method
285 * - :c:func:`TIFFGetVersion`
286 - return library version string
287 * - :c:func:`TIFFGetWriteProc`
288 - returns a pointer to file write method
289 * - :c:func:`TIFFIsBigEndian`
290 - returns a non-zero value if the file is BigEndian and zero if the file is
291 LittleEndian
292 * - :c:func:`TIFFIsBigTIFF`
293 - returns a non-zero value if the file is in BigTIFF style
294 * - :c:func:`TIFFIsByteSwapped`
295 - return true if image data is byte-swapped
296 * - :c:func:`TIFFIsCODECConfigured`
297 - check, whether we have working codec
298 * - :c:func:`TIFFIsMSB2LSB`
299 - return true if image data is being returned with bit 0 as the most significant bit
300 * - :c:func:`TIFFIsTiled`
301 - return true if image data is tiled
302 * - :c:func:`TIFFIsUpSampled`
303 - returns a non-zero value if image data returned through the read interface
304 Routines is being up-sampled
305 * - :c:func:`TIFFLastDirectory`
306 - returns a non-zero value if the current directory is the last directory
307 in the file; otherwise zero is returned
308 * - :c:func:`TIFFMergeFieldInfo`
309 - adds application defined TIFF tags to the list of known ``libtiff`` tags
310 * - :c:func:`TIFFNumberOfDirectories`
311 - return number of directories in a file
312 * - :c:func:`TIFFNumberOfStrips`
313 - return number of strips in an image
314 * - :c:func:`TIFFNumberOfTiles`
315 - return number of tiles in an image
316 * - :c:func:`TIFFOpen`
317 - open a file for reading or writing
318 * - :c:func:`TIFFOpenExt`
319 - open a file for reading or writing with options,
320 such as re-entrant error and warning handlers may be passed
321 * - :c:func:`TIFFOpenW`
322 - opens a TIFF file with a Unicode filename, for read/writing
323 * - :c:func:`TIFFOpenWExt`
324 - opens a TIFF file with a Unicode filename, for read/writing
325 with options, such as re-entrant error and warning handlers may be passed
326 * - :c:func:`TIFFOpenOptionsAlloc`
327 - allocates memory for :c:type:`TIFFOpenOptions` opaque structure
328 * - :c:func:`TIFFOpenOptionsFree`
329 - releases the allocated memory for :c:type:`TIFFOpenOptions`
330 * - :c:func:`TIFFOpenOptionsSetMaxSingleMemAlloc`
331 - limits the maximum single memory allocation within ``libtiff``
332 * - :c:func:`TIFFOpenOptionsSetMaxCumulatedMemAlloc`
333 - limits the maximum cumulated memory allocation within ``libtiff``
334 * - :c:func:`TIFFOpenOptionsSetErrorHandlerExtR`
335 - setup of a user-specific and per-TIFF handle (re-entrant) error handler
336 * - :c:func:`TIFFOpenOptionsSetWarningHandlerExtR`
337 - setup of a user-specific and per-TIFF handle (re-entrant) warning handler
338 * - :c:func:`TIFFPrintDirectory`
339 - print description of the current directory
340 * - :c:func:`TIFFRasterScanlineSize`
341 - returns the size in bytes of a complete decoded and packed raster scanline
342 * - :c:func:`TIFFRasterScanlineSize64`
343 - return size as :c:type:`uint64_t`
344 * - :c:func:`TIFFRawStripSize`
345 - return number of bytes in a raw strip
346 * - :c:func:`TIFFRawStripSize64`
347 - return number of bytes in a raw strip as :c:type:`uint64_t`
348 * - :c:func:`TIFFReadBufferSetup`
349 - specify i/o buffer for reading
350 * - :c:func:`TIFFReadCustomDirectory`
351 - read the custom directory from the given offset
352 and set the context of the TIFF-handle tif to that custom directory
353 * - :c:func:`TIFFReadDirectory`
354 - read the next directory
355 * - :c:func:`TIFFReadEncodedStrip`
356 - read and decode a strip of data
357 * - :c:func:`TIFFReadEncodedTile`
358 - read and decode a tile of data
359 * - :c:func:`TIFFReadEXIFDirectory`
360 - read the EXIF directory from the given offset
361 and set the context of the TIFF-handle tif to that EXIF directory
362 * - :c:func:`TIFFReadFromUserBuffer`
363 - replaces the use of :c:func:`TIFFReadEncodedStrip` / :c:func:`TIFFReadEncodedTile`
364 when the user can provide the buffer for the input data
365 * - :c:func:`TIFFReadGPSDirectory`
366 - read the GPS directory from the given offset
367 and set the context of the TIFF-handle tif to that GPS directory
368 * - :c:func:`TIFFReadRawStrip`
369 - read a raw strip of data
370 * - :c:func:`TIFFReadRawTile`
371 - read a raw tile of data
372 * - :c:func:`TIFFReadRGBAImage`
373 - read an image into a fixed format raster
374 * - :c:func:`TIFFReadRGBAImageOriented`
375 - works like :c:func:`TIFFReadRGBAImage` except that the user can specify
376 the raster origin position
377 * - :c:func:`TIFFReadRGBAStrip`
378 - reads a single strip of a strip-based image into memory, storing the
379 result in the user supplied RGBA raster
380 * - :c:func:`TIFFReadRGBAStripExt`
381 - same as :c:func:`TIFFReadRGBAStrip` but providing the parameter `stop_on_error`
382 * - :c:func:`TIFFReadRGBATile`
383 - reads a single tile of a tile-based image into memory, storing the
384 result in the user supplied RGBA raster
385 * - :c:func:`TIFFReadRGBATileExt`
386 - same as :c:func:`TIFFReadRGBATile` but providing the parameter `stop_on_error`
387 * - :c:func:`TIFFReadScanline`
388 - read and decode a row of data
389 * - :c:func:`TIFFReadTile`
390 - read and decode a tile of data
391 * - :c:func:`TIFFRegisterCODEC`
392 - override standard codec for the specific scheme
393 * - :c:func:`TIFFReverseBits`
394 - reverse bits in an array of bytes
395 * - :c:func:`TIFFRewriteDirectory`
396 - operates similarly to :c:func:`TIFFWriteDirectory`, but can be called
397 with directories previously read or written that already have an established
398 location in the file and places it at the end of the file
399 * - :c:func:`TIFFRGBAImageBegin`
400 - setup decoder state for TIFFRGBAImageGet
401 * - :c:func:`TIFFRGBAImageEnd`
402 - release TIFFRGBAImage decoder state
403 * - :c:func:`TIFFRGBAImageGet`
404 - read and decode an image
405 * - :c:func:`TIFFRGBAImageOK`
406 - is image readable by TIFFRGBAImageGet
407 * - :c:func:`TIFFScanlineSize`
408 - return size of a scanline
409 * - :c:func:`TIFFScanlineSize64`
410 - return size of a scanline as :c:type:`uint64_t`
411 * - :c:func:`TIFFSetClientdata`
412 - set open file's clientdata (file descriptor/handle),
413 and return previous value
414 * - :c:func:`TIFFSetClientInfo`
415 - adds or replaces an entry in the clientinfo-list
416 * - :c:func:`TIFFSetCompressionScheme`
417 - set compression scheme
418 * - :c:func:`TIFFSetDirectory`
419 - set the current directory
420 * - :c:func:`TIFFSetErrorHandler`
421 - set error handler function
422 * - :c:func:`TIFFSetErrorHandlerExt`
423 - set error handler function with a file handle as parameter
424 * - :c:func:`TIFFSetField`
425 - set a tag's value in the current directory
426 * - :c:func:`TIFFSetFileName`
427 - sets the file name in the TIFF-structure and returns the old file name
428 * - :c:func:`TIFFSetFileno`
429 - overwrites a copy of the open file's I/O descriptor, and return previous value
430 (refer to detailed description)
431 * - :c:func:`TIFFSetMode`
432 - sets the ``libtiff`` open mode in the TIFF-structure and returns the old mode
433 * - :c:func:`TIFFSetSubDirectory`
434 - set the current directory
435 * - :c:func:`TIFFSetTagExtender`
436 - is used to register the merge function for user defined tags as an
437 extender callback with ``libtiff``
438 * - :c:func:`TIFFSetupStrips`
439 - setup or reset strip parameters and strip array memory
440 * - :c:func:`TIFFSetWarningHandler`
441 - set warning handler function
442 * - :c:func:`TIFFSetWarningHandlerExt`
443 - set warning handler function with a file handle as parameter
444 * - :c:func:`TIFFSetWriteOffset`
445 - set current write offset
446 * - :c:func:`TIFFStripSize`
447 - return size of a strip
448 * - :c:func:`TIFFStripSize64`
449 - return equivalent size for a strip of data as :c:type:`uint64_t`
450 * - :c:func:`TIFFSwabArrayOfDouble`
451 - swap bytes of an array of doubles
452 * - :c:func:`TIFFSwabArrayOfFloat`
453 - swap bytes of an array of floats
454 * - :c:func:`TIFFSwabArrayOfLong`
455 - swap bytes of an array of longs
456 * - :c:func:`TIFFSwabArrayOfLong8`
457 - swap bytes of an array of uint64_t
458 * - :c:func:`TIFFSwabArrayOfShort`
459 - swap bytes of an array of shorts
460 * - :c:func:`TIFFSwabArrayOfTriples`
461 - swap the first and third byte of each triple within an array of bytes
462 * - :c:func:`TIFFSwabDouble`
463 - swap bytes of double
464 * - :c:func:`TIFFSwabFloat`
465 - swap bytes of float
466 * - :c:func:`TIFFSwabLong`
467 - swap bytes of long
468 * - :c:func:`TIFFSwabLong8`
469 - swap bytes of long long (uint64_t)
470 * - :c:func:`TIFFSwabShort`
471 - swap bytes of short
472 * - :c:func:`TIFFTileRowSize`
473 - return size of a row in a tile
474 * - :c:func:`TIFFTileRowSize64`
475 - return size of a row in a tile as :c:type:`uint64_t`
476 * - :c:func:`TIFFTileSize`
477 - return size of a tile
478 * - :c:func:`TIFFTileSize64`
479 - return size of a tile as :c:type:`uint64_t`
480 * - :c:func:`TIFFUnlinkDirectory`
481 - unlink the specified directory from the directory chain
482 * - :c:func:`TIFFUnRegisterCODEC`
483 - unregisters the codec
484 * - :c:func:`TIFFUnsetField`
485 - clear the contents of the field in the internal structure
486 * - :c:func:`TIFFVGetField`
487 - return tag value in current directory
488 * - :c:func:`TIFFVGetFieldDefaulted`
489 - return tag value in current directory
490 * - :c:func:`TIFFVSetField`
491 - set a tag's value in the current directory
492 * - :c:func:`TIFFVStripSize`
493 - return number of bytes in a strip
494 * - :c:func:`TIFFVStripSize64`
495 - return number of bytes in a strip with *nrows* rows of data as :c:type:`uint64_t`
496 * - :c:func:`TIFFVTileSize`
497 - returns the number of bytes in a row-aligned tile with *nrows* of data
498 * - :c:func:`TIFFVTileSize64`
499 - returns the number of bytes in a row-aligned tile with *nrows* of data
500 a :c:type:`uint64_t` number
501 * - :c:func:`TIFFWarning`
502 - library-wide warning handling function printing to ``stderr``
503 * - :c:func:`TIFFWarningExt`
504 - user-specific library-wide warning handling function that can be passed
505 a file handle, which is set to the open TIFF file within ``libtiff``
506 * - :c:func:`TIFFWarningExtR`
507 - user-specific re-entrant library warning handling function,
508 to which its TIFF structure is passed
509 containing the pointer to a user-specific data object
510 * - :c:func:`TIFFWriteBufferSetup`
511 - sets up the data buffer used to write raw (encoded) data to a file
512 * - :c:func:`TIFFWriteCheck`
513 - verify file is writable and that the directory information is setup properly
514 * - :c:func:`TIFFWriteCustomDirectory`
515 - write the current custom directory (also EXIF or GPS) to file
516 * - :c:func:`TIFFWriteDirectory`
517 - write the current directory
518 * - :c:func:`TIFFWriteEncodedStrip`
519 - compress and write a strip of data
520 * - :c:func:`TIFFWriteEncodedTile`
521 - compress and write a tile of data
522 * - :c:func:`TIFFWriteRawStrip`
523 - write a raw strip of data
524 * - :c:func:`TIFFWriteRawTile`
525 - write a raw tile of data
526 * - :c:func:`TIFFWriteScanline`
527 - write a scanline of data
528 * - :c:func:`TIFFWriteTile`
529 - compress and write a tile of data
530 * - :c:func:`TIFFXYZToRGB`
531 - perform CIE XYZ to RGB conversion
532 * - :c:func:`TIFFYCbCrtoRGB`
533 - perform YCbCr to RGB conversion
534 * - :c:func:`TIFFYCbCrToRGBInit`
535 - initialize YCbCr to RGB conversion state
536
537 .. list-table:: *Libtiff auxillary functions*
538 :widths: 5 20
539 :header-rows: 1
540
541 * - Name
542 - Description
543 * - :c:func:`_TIFFCheckMalloc`
544 - checking for integer overflow before dynamically allocate memory buffer
545 * - :c:func:`_TIFFCheckRealloc`
546 - checking for integer overflow before dynamically reallocate memory buffer
547 * - :c:func:`_TIFFClampDoubleToUInt32`
548 - clamps double values into the range of :c:type:`uint32_t` (i.e. 0 .. 0xFFFFFFFF)
549 * - :c:func:`_TIFFfree`
550 - free memory buffer
551 * - :c:func:`_TIFFGetExifFields`
552 - return a pointer to the ``libtiff`` internal definition list of the EXIF tags
553 * - :c:func:`_TIFFGetGpsFields`
554 - return a pointer to the ``libtiff`` internal definition list of the GPS tags
555 * - :c:func:`_TIFFmalloc`
556 - dynamically allocate memory buffer
557 * - :c:func:`_TIFFmemcmp`
558 - compare contents of the memory buffers
559 * - :c:func:`_TIFFmemcpy`
560 - copy contents of the one buffer to another
561 * - :c:func:`_TIFFmemset`
562 - fill memory buffer with a constant byte
563 * - :c:func:`_TIFFMultiply32`
564 - checks for an integer overflow of the multiplication result of `uint32_t` and
565 return the multiplication result or `0` if an overflow would happen
566 * - :c:func:`_TIFFMultiply64`
567 - checks for an integer overflow of the multiplication result of `uint64_t` and
568 return the multiplication result or `0` if an overflow would happen
569 * - :c:func:`_TIFFrealloc`
570 - dynamically reallocate memory buffer
571 * - :c:func:`_TIFFRewriteField`
572 - Rewrite a field in the directory on disk without regard
573 to updating the TIFF directory structure in memory
574
575
576 Tag usage
577 ---------
578
579 For a table of TIFF tags recognized by the library refer to
580 :doc:`/specification/coverage`.
581
582 "Pseudo tags"
583 -------------
584
585 In addition to the normal TIFF
586 tags the library supports a collection of
587 tags whose values lie in a range outside the valid range of TIFF
588 tags. These tags are termed *pseudo-tags*
589 and are used to control various codec-specific functions within the library.
590 The table below summarizes the defined pseudo-tags.
591
592 .. list-table:: libtiff supported tags
593 :widths: 10 2 2 15
594 :header-rows: 1
595
596 * - Tag name
597 - Codec
598 - R/W
599 - Library Use/Notes
600
601 * - :c:macro:`TIFFTAG_FAXMODE`
602 - G3
603 - R/W
604 - general codec operation
605 * - :c:macro:`TIFFTAG_FAXFILLFUNC`
606 - G3/G4
607 - R/W
608 - bitmap fill function
609 * - :c:macro:`TIFFTAG_JPEGQUALITY`
610 - JPEG
611 - R/W
612 - compression quality control
613 * - :c:macro:`TIFFTAG_JPEGCOLORMODE`
614 - JPEG
615 - R/W
616 - control colorspace conversions
617 * - :c:macro:`TIFFTAG_JPEGTABLESMODE`
618 - JPEG
619 - R/W
620 - control contents of ``JPEGTables`` tag
621 * - :c:macro:`TIFFTAG_ZIPQUALITY`
622 - Deflate
623 - R/W
624 - compression quality level
625 * - :c:macro:`TIFFTAG_PIXARLOGDATAFMT`
626 - PixarLog
627 - R/W
628 - user data format
629 * - :c:macro:`TIFFTAG_PIXARLOGQUALITY`
630 - PixarLog
631 - R/W
632 - compression quality level
633 * - :c:macro:`TIFFTAG_SGILOGDATAFMT`
634 - SGILog
635 - R/W
636 - user data format
637
638 :c:macro:`TIFFTAG_FAXMODE`:
639
640 Control the operation of the Group 3 codec.
641 Possible values (independent bits that can be combined by
642 or'ing them together) are:
643
644 :c:macro:`FAXMODE_CLASSIC`:
645
646 (enable old-style format in which the ``RTC``
647 is written at the end of the last strip),
648
649 :c:macro:`FAXMODE_NORTC`:
650
651 (opposite of :c:macro:`FAXMODE_CLASSIC`; also called
652 :c:macro:`FAXMODE_CLASSF`),
653
654 :c:macro:`FAXMODE_NOEOL`:
655
656 (do not write ``EOL`` codes at the start of each row of data),
657
658 :c:macro:`FAXMODE_BYTEALIGN`:
659
660 (align each encoded row to an 8-bit boundary),
661
662 :c:macro:`FAXMODE_WORDALIGN`:
663
664 (align each encoded row to an 16-bit boundary),
665
666 The default value is dependent on the compression scheme; this
667 pseudo-tag is used by the various G3 and G4 codecs to share code.
668
669 :c:macro:`TIFFTAG_FAXFILLFUNC`:
670
671 Control the function used to convert arrays of black and white
672 runs to packed bit arrays.
673 This hook can be used to image decoded scanlines in multi-bit
674 depth rasters (e.g. for display in colormap mode)
675 or for other purposes.
676 The default value is a pointer to a builtin function that images
677 packed bilevel data.
678
679 :c:macro:`TIFFTAG_IPTCNEWSPHOTO`:
680
681 Tag contains image metadata per the IPTC newsphoto spec: Headline,
682 captioning, credit, etc... Used by most wire services.
683
684 :c:macro:`TIFFTAG_PHOTOSHOP`:
685
686 Tag contains Photoshop captioning information and metadata. Photoshop
687 uses in parallel and redundantly alongside :c:macro:`IPTCNEWSPHOTO` information.
688
689 :c:macro:`TIFFTAG_JPEGQUALITY`:
690
691 Control the compression quality level used in the baseline algorithm.
692 Note that quality levels are in the range 0-100 with a default value of 75.
693
694 :c:macro:`TIFFTAG_JPEGCOLORMODE`:
695
696 Control whether or not conversion is done between
697 RGB and YCbCr colorspaces.
698 Possible values are:
699
700 :c:macro:`JPEGCOLORMODE_RAW`:
701
702 (do not convert), and
703
704 :c:macro:`JPEGCOLORMODE_RGB`:
705
706 (convert to/from RGB)
707
708 The default value is :c:macro:`JPEGCOLORMODE_RAW`.
709
710 :c:macro:`TIFFTAG_JPEGTABLESMODE`:
711
712 Control the information written in the ``JPEGTables`` tag.
713 Possible values (independent bits that can be combined by
714 or'ing them together) are:
715
716 :c:macro:`JPEGTABLESMODE_QUANT`:
717
718 (include quantization tables), and
719
720 :c:macro:`JPEGTABLESMODE_HUFF`:
721
722 (include Huffman encoding tables).
723
724 The default value is :c:expr:`JPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF`.
725
726 :c:macro:`TIFFTAG_ZIPQUALITY`:
727
728 Control the compression technique used by the Deflate codec.
729 Quality levels are in the range 1-9 with larger numbers yielding better
730 compression at the cost of more computation.
731 The default quality level is 6 which yields a good time-space tradeoff.
732
733 :c:macro:`TIFFTAG_PIXARLOGDATAFMT`:
734
735 Control the format of user data passed *in*
736 to the PixarLog codec when encoding and passed
737 *out* from when decoding. Possible values are:
738
739 :c:macro:`PIXARLOGDATAFMT_8BIT`:
740
741 for 8-bit unsigned pixels,
742
743 :c:macro:`PIXARLOGDATAFMT_8BITABGR`:
744
745 for 8-bit unsigned ABGR-ordered pixels,
746
747 :c:macro:`PIXARLOGDATAFMT_11BITLOG`:
748
749 for 11-bit log-encoded raw data,
750
751 :c:macro:`PIXARLOGDATAFMT_12BITPICIO`:
752
753 for 12-bit PICIO-compatible data,
754
755 :c:macro:`PIXARLOGDATAFMT_16BIT`:
756
757 for 16-bit signed samples, and
758
759 :c:macro:`PIXARLOGDATAFMT_FLOAT`:
760
761 for 32-bit IEEE floating point samples.
762
763 :c:macro:`TIFFTAG_PIXARLOGQUALITY`:
764
765 Control the compression technique used by the PixarLog codec.
766 This value is treated identically to :c:macro:`TIFFTAG_ZIPQUALITY`; see the
767 above description.
768
769 :c:macro:`TIFFTAG_SGILOGDATAFMT`:
770
771 Control the format of client data passed *in*
772 to the SGILog codec when encoding and passed
773 *out* from when decoding. Possible values are:
774
775 :c:macro:`SGILOGDATAFMT_FLTXYZ`:
776
777 for converting between LogLuv and 32-bit IEEE floating valued XYZ pixels,
778
779 :c:macro:`SGILOGDATAFMT_16BITLUV`:
780
781 for 16-bit encoded Luv pixels,
782
783 :c:macro:`SGILOGDATAFMT_32BITRAW`:
784 :c:macro:`SGILOGDATAFMT_24BITRAW`:
785
786 for no conversion of data,
787
788 :c:macro:`SGILOGDATAFMT_8BITRGB`:
789
790 for returning 8-bit RGB data (valid only when decoding LogLuv-encoded data),
791
792 :c:macro:`SGILOGDATAFMT_FLTY`:
793
794 for converting between LogL and 32-bit IEEE floating valued Y pixels,
795
796 :c:macro:`SGILOGDATAFMT_16BITL`:
797
798 for 16-bit encoded L pixels, and
799
800 :c:macro:`SGILOGDATAFMT_8BITGRY`:
801
802 for returning 8-bit greyscale data
803 (valid only when decoding LogL-encoded data).
804
805 Diagnostics
806 -----------
807
808 All error messages are directed through the :c:func:`TIFFErrorExtR` routine.
809 By default messages are directed to ``stderr`` in the form:
810 ``module: message\n``.
811 Warning messages are likewise directed through the
812 :c:func:`TIFFWarningExtR` routine.
813
814 See also
815 --------
816
817 :doc:`/tools/fax2tiff`,
818 :doc:`/tools/pal2rgb`,
819 :doc:`/tools/ppm2tiff`,
820 :doc:`/tools/rgb2ycbcr`,
821 :doc:`/tools/raw2tiff`,
822 :doc:`/tools/tiff2bw`,
823 :doc:`/tools/tiffdither`,
824 :doc:`/tools/tiffdump`,
825 :doc:`/tools/tiffcp`,
826 :doc:`/tools/tiffcmp`,
827 :doc:`/tools/tiffgt`,
828 :doc:`/tools/tiffinfo`,
829 :doc:`/tools/tiffmedian`,
830 :doc:`/tools/tiffsplit`,
831
832 **"Tag Image File Format Specification *Revision 6.0*"**,
833 an Aldus Technical Memorandum.
834
835 **"The Spirit of TIFF Class F"** ,
836 an appendix to the TIFF 5.0 specification prepared by Cygnet Technologies.
837
838 Bugs
839 ----
840
841 * The library does not support multi-sample images
842 where some samples have different bits/sample.
843
844 * The library does not support random access to compressed data
845 that is organized with more than one row per tile or strip.