]> git.saurik.com Git - wxWidgets.git/blame - src/tiff/man/libtiff.3tiff
Border corrections
[wxWidgets.git] / src / tiff / man / libtiff.3tiff
CommitLineData
8414a40c
VZ
1.\" $Id: libtiff.3tiff,v 1.3 2005/11/02 11:07:19 dron Exp $
2.\"
3.\" Copyright (c) 1988-1997 Sam Leffler
4.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
5.\"
6.\" Permission to use, copy, modify, distribute, and sell this software and
7.\" its documentation for any purpose is hereby granted without fee, provided
8.\" that (i) the above copyright notices and this permission notice appear in
9.\" all copies of the software and related documentation, and (ii) the names of
10.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
11.\" publicity relating to the software without the specific, prior written
12.\" permission of Sam Leffler and Silicon Graphics.
13.\"
14.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
15.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
16.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
17.\"
18.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
19.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
20.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
22.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23.\" OF THIS SOFTWARE.
24.\"
25.if n .po 0
26.TH INTRO 3TIFF "November 2, 2005" "libtiff"
27.SH NAME
28libtiff \- introduction to
29.IR libtiff ,
30a library for reading and writing
31.SM TIFF
32files
33.SH SYNOPSIS
34.B "#include <tiffio.h>"
35.sp
36cc file.c
37.B -ltiff
38.SH DESCRIPTION
39.I libtiff
40is a library for reading and writing data files encoded with the
41.I "Tag Image File"
42format, Revision 6.0 (or revision 5.0 or revision 4.0). This file format is
43suitable for archiving multi-color and monochromatic image data.
44.PP
45The library supports several compression algorithms, as indicated by the
46.I Compression
47field, including:
48no compression (1),
49.SM CCITT
501D Huffman compression (2),
51.SM CCITT
52Group 3 Facsimile compression (3),
53.SM CCITT
54Group 4 Facsimile compression (4),
55Lempel-Ziv & Welch compression (5),
56baseline JPEG compression (7),
57word-aligned 1D Huffman compression (32771),
58and
59PackBits compression (32773).
60In addition, several nonstandard compression algorithms are supported: the
614-bit compression algorithm used by the
62.I ThunderScan
63program (32809) (decompression only), NeXT's 2-bit compression algorithm
64(32766) (decompression only), an experimental LZ-style algorithm known as
65Deflate (32946), and an experimental CIE LogLuv compression scheme designed
66for images with high dynamic range (32845 for LogL and 32845 for LogLuv).
67Directory information may be in either little- or big-endian byte order\-byte
68swapping is automatically done by the library. Data bit ordering may be either
69Most Significant Bit (\c
70.SM MSB\c
71) to Least Significant Bit (\c
72.SM LSB\c
73) or
74.SM LSB
75to
76.SM MSB.
77Finally, the library does not support files in which the
78.IR BitsPerSample ,
79.IR Compression ,
80.IR MinSampleValue ,
81or
82.IR MaxSampleValue
83fields are defined differently on a per-sample basis
84(in Rev. 6.0 the
85.I Compression
86tag is not defined on a per-sample basis, so this is immaterial).
87.SH "DATA TYPES"
88The library makes extensive use of C typedefs to promote portability.
89Two sets of typedefs are used, one for communication with clients
90of the library and one for internal data structures and parsing of the
91.SM TIFF
92format.
93The following typedefs are exposed to users either through function
94definitions or through parameters passed through the varargs interfaces.
95.in +.5i
96.sp 5p
97.ta +\w'typedef unsigned <\fIthing\fP> uint32; 'u
98.nf
99typedef unsigned short uint16; 16-bit unsigned integer
100typedef unsigned <\fIthing\fP> uint32; 32-bit unsigned integer
101.sp 5p
102typedef unsigned int ttag_t; directory tag
103typedef uint16 tdir_t; directory index
104typedef uint16 tsample_t; sample number
105typedef uint32 tstrip_t; strip number
106typedef uint32 ttile_t; tile number
107typedef int32 tsize_t; i/o size in bytes
108typedef void* tdata_t; image data ref
109typedef void* thandle_t; client data handle
110typedef int32 toff_t; file offset
111.fi
112.sp 5p
113.in -.5i
114Note that
115.IR tstrip_t ,
116.IR ttile_t ,
117and
118.I tsize_t
119are constrained to be no more than 32-bit quantities by 32-bit fields they are
120stored in in the
121.SM TIFF
122image.
123Likewise
124.I tsample_t
125is limited by the 16-bit field used to store the
126.I SamplesPerPixel
127tag.
128.I tdir_t
129constrains the maximum number of
130.SM IFDs
131that may appear in an image and may be an arbitrary size (w/o penalty).
132.I ttag_t
133must be either int, unsigned int, pointer, or double because the library uses
134a varargs interface and
135.SM "ANSI C"
136restricts the type of the parameter before an ellipsis to be a promoted type.
137.I toff_t
138is defined as int32 because TIFF file offsets are (unsigned) 32-bit
139quantities. A signed value is used because some interfaces return \-1 on
140error. Finally, note that user-specified data references are passed as opaque
141handles and only cast at the lowest layers where their type is presumed.
142.SH "LIST OF ROUTINES"
143The following routines are part of the library. Consult specific manual pages
144for details on their operation; on most systems doing ``man function-name''
145will work.
146.sp
147.nf
148.ta \w'TIFFCheckpointDirectory'u+2n
149\fIName\fP \fIDescription\fP
150.sp 5p
151TIFFCheckpointDirectory writes the current state of the directory
152TIFFCheckTile very x,y,z,sample is within image
153TIFFCIELabToRGBInit initialize CIE L*a*b* 1976 to RGB conversion state
154TIFFCIELabToXYZ perform CIE L*a*b* 1976 to CIE XYZ conversion
155TIFFClientOpen open a file for reading or writing
156TIFFClose close an open file
157TIFFComputeStrip return strip containing y,sample
158TIFFComputeTile return tile containing x,y,z,sample
159TIFFCurrentDirectory return index of current directory
160TIFFCurrentRow return index of current scanline
161TIFFCurrentStrip return index of current strip
162TIFFCurrentTile return index of current tile
163TIFFDataWidth return the size of TIFF data types
164TIFFError library error handler
165TIFFFdOpen open a file for reading or writing
166TIFFFileName return name of open file
167TIFFFileno return open file descriptor
168TIFFFindCODEC find standard codec for the specific scheme
169TIFFFlush flush all pending writes
170TIFFFlushData flush pending data writes
171TIFFGetBitRevTable return bit reversal table
172TIFFGetField return tag value in current directory
173TIFFGetFieldDefaulted return tag value in current directory
174TIFFGetMode return open file mode
175TIFFGetVersion return library version string
176TIFFIsCODECConfigured check, whether we have working codec
177TIFFIsMSB2LSB return true if image data is being returned
178 with bit 0 as the most significant bit
179TIFFIsTiled return true if image data is tiled
180TIFFIsByteSwapped return true if image data is byte-swapped
181TIFFNumberOfStrips return number of strips in an image
182TIFFNumberOfTiles return number of tiles in an image
183TIFFOpen open a file for reading or writing
184TIFFPrintDirectory print description of the current directory
185TIFFReadBufferSetup specify i/o buffer for reading
186TIFFReadDirectory read the next directory
187TIFFReadEncodedStrip read and decode a strip of data
188TIFFReadEncodedTile read and decode a tile of data
189TIFFReadRawStrip read a raw strip of data
190TIFFReadRawTile read a raw tile of data
191TIFFReadRGBAImage read an image into a fixed format raster
192TIFFReadScanline read and decode a row of data
193TIFFReadTile read and decode a tile of data
194TIFFRegisterCODEC override standard codec for the specific scheme
195TIFFReverseBits reverse bits in an array of bytes
196TIFFRGBAImageBegin setup decoder state for TIFFRGBAImageGet
197TIFFRGBAImageEnd release TIFFRGBAImage decoder state
198TIFFRGBAImageGet read and decode an image
199TIFFRGBAImageOK is image readable by TIFFRGBAImageGet
200TIFFScanlineSize return size of a scanline
201TIFFSetDirectory set the current directory
202TIFFSetSubDirectory set the current directory
203TIFFSetErrorHandler set error handler function
204TIFFSetField set a tag's value in the current directory
205TIFFSetWarningHandler set warning handler function
206TIFFStripSize returns size of a strip
207TIFFRawStripSize returns the number of bytes in a raw strip
208TIFFSwabShort swap bytes of short
209TIFFSwabLong swap bytes of long
210TIFFSwabArrayOfShort swap bytes of an array of shorts
211TIFFSwabArrayOfLong swap bytes of an array of longs
212TIFFTileRowSize return size of a row in a tile
213TIFFTileSize return size of a tile
214TIFFUnRegisterCODEC unregisters the codec
215TIFFVGetField return tag value in current directory
216TIFFVGetFieldDefaulted return tag value in current directory
217TIFFVSetField set a tag's value in the current directory
218TIFFVStripSize returns the number of bytes in a strip
219TIFFWarning library warning handler
220TIFFWriteDirectory write the current directory
221TIFFWriteEncodedStrip compress and write a strip of data
222TIFFWriteEncodedTile compress and write a tile of data
223TIFFWriteRawStrip write a raw strip of data
224TIFFWriteRawTile write a raw tile of data
225TIFFWriteScanline write a scanline of data
226TIFFWriteTile compress and write a tile of data
227TIFFXYZToRGB perform CIE XYZ to RGB conversion
228TIFFYCbCrToRGBInit initialize YCbCr to RGB conversion state
229TIFFYCbCrtoRGB perform YCbCr to RGB conversion
230.sp
231Auxiliary functions:
232_TIFFfree free memory buffer
233_TIFFmalloc dynamically allocate memory buffer
234_TIFFmemcmp compare contents of the memory buffers
235_TIFFmemcpy copy contents of the one buffer to another
236_TIFFmemset fill memory buffer with a constant byte
237_TIFFrealloc dynamically reallocate memory buffer
238
239.fi
240.SH "TAG USAGE"
241The table below lists the
242.SM TIFF
243tags that are recognized and handled by the library.
244If no use is indicated in the table, then the library
245reads and writes the tag, but does not use it internally.
246Note that some tags are meaningful only when a particular
247compression scheme is being used; e.g.
248.I Group3Options
249is only useful if
250.I Compression
251is set to
252.SM CCITT
253Group 3 encoding.
254Tags of this sort are considered
255.I codec-specific
256tags and the library does not recognize them except when the
257.I Compression
258tag has been previously set to the relevant compression scheme.
259.sp
260.nf
261.ta \w'TIFFTAG_JPEGTABLESMODE'u+2n +\w'Value'u+2n +\w'R/W'u+2n
262\fITag Name\fP \fIValue\fP \fIR/W\fP \fILibrary Use/Notes\fP
263.sp 5p
264.nf
265Artist 315 R/W
266BadFaxLines 326 R/W
267BitsPerSample 258 R/W lots
268CellLength 265 parsed but ignored
269CellWidth 264 parsed but ignored
270CleanFaxData 327 R/W
271ColorMap 320 R/W
272ColorResponseUnit 300 parsed but ignored
273Compression 259 R/W choosing codec
274ConsecutiveBadFaxLines 328 R/W
275Copyright 33432 R/W
276DataType 32996 R obsoleted by SampleFormat tag
277DateTime 306 R/W
278DocumentName 269 R/W
279DotRange 336 R/W
280ExtraSamples 338 R/W lots
281FaxRecvParams 34908 R/W
282FaxSubAddress 34909 R/W
283FaxRecvTime 34910 R/W
284FillOrder 266 R/W control bit order
285FreeByteCounts 289 parsed but ignored
286FreeOffsets 288 parsed but ignored
287GrayResponseCurve 291 parsed but ignored
288GrayResponseUnit 290 parsed but ignored
289Group3Options 292 R/W used by Group 3 codec
290Group4Options 293 R/W
291HostComputer 316 R/W
292ImageDepth 32997 R/W tile/strip calculations
293ImageDescription 270 R/W
294ImageLength 257 R/W lots
295ImageWidth 256 R/W lots
296InkNames 333 R/W
297InkSet 332 R/W
298JPEGTables 347 R/W used by JPEG codec
299Make 271 R/W
300Matteing 32995 R obsoleted by ExtraSamples tag
301MaxSampleValue 281 R/W
302MinSampleValue 280 R/W
303Model 272 R/W
304NewSubFileType 254 R/W called SubFileType in spec
305NumberOfInks 334 R/W
306Orientation 274 R/W
307PageName 285 R/W
308PageNumber 297 R/W
309PhotometricInterpretation 262 R/W used by Group 3 and JPEG codecs
310PlanarConfiguration 284 R/W data i/o
311Predictor 317 R/W used by LZW and Deflate codecs
312PrimaryChromacities 319 R/W
313ReferenceBlackWhite 532 R/W
314ResolutionUnit 296 R/W used by Group 3 codec
315RowsPerStrip 278 R/W data i/o
316SampleFormat 339 R/W
317SamplesPerPixel 277 R/W lots
318SMinSampleValue 340 R/W
319SMaxSampleValue 341 R/W
320Software 305 R/W
321StoNits 37439 R/W
322StripByteCounts 279 R/W data i/o
323StripOffsets 273 R/W data i/o
324SubFileType 255 R/W called OSubFileType in spec
325TargetPrinter 337 R/W
326Thresholding 263 R/W
327TileByteCounts 324 R/W data i/o
328TileDepth 32998 R/W tile/strip calculations
329TileLength 323 R/W data i/o
330TileOffsets 324 R/W data i/o
331TileWidth 322 R/W data i/o
332TransferFunction 301 R/W
333WhitePoint 318 R/W
334XPosition 286 R/W
335XResolution 282 R/W
336YCbCrCoefficients 529 R/W used by TIFFRGBAImage support
337YCbCrPositioning 531 R/W tile/strip size calulcations
338YCbCrSubsampling 530 R/W
339YPosition 286 R/W
340YResolution 283 R/W used by Group 3 codec
341.SH "PSEUDO TAGS"
342In addition to the normal
343.SM TIFF
344tags the library supports a collection of
345tags whose values lie in a range outside the valid range of
346.SM TIFF
347tags.
348These tags are termed
349.I pseud-tags
350and are used to control various codec-specific functions within the library.
351The table below summarizes the defined pseudo-tags.
352.sp
353.nf
354.ta \w'TIFFTAG_JPEGTABLESMODE'u+2n +\w'Codec'u+2n +\w'R/W'u+2n
355\fITag Name\fP \fICodec\fP \fIR/W\fP \fILibrary Use/Notes\fP
356.sp 5p
357.nf
358TIFFTAG_FAXMODE G3 R/W general codec operation
359TIFFTAG_FAXFILLFUNC G3/G4 R/W bitmap fill function
360TIFFTAG_JPEGQUALITY JPEG R/W compression quality control
361TIFFTAG_JPEGCOLORMODE JPEG R/W control colorspace conversions
362TIFFTAG_JPEGTABLESMODE JPEG R/W control contents of \fIJPEGTables\fP tag
363TIFFTAG_ZIPQUALITY Deflate R/W compression quality level
364TIFFTAG_PIXARLOGDATAFMT PixarLog R/W user data format
365TIFFTAG_PIXARLOGQUALITY PixarLog R/W compression quality level
366TIFFTAG_SGILOGDATAFMT SGILog R/W user data format
367.fi
368.TP
369.B TIFFTAG_FAXMODE
370Control the operation of the Group 3 codec.
371Possible values (independent bits that can be combined by
372or'ing them together) are:
373FAXMODE_CLASSIC
374(enable old-style format in which the
375.SM RTC
376is written at the end of the last strip),
377FAXMODE_NORTC
378(opposite of
379FAXMODE_CLASSIC;
380also called
381FAXMODE_CLASSF),
382FAXMODE_NOEOL
383(do not write
384.SM EOL
385codes at the start of each row of data),
386FAXMODE_BYTEALIGN
387(align each encoded row to an 8-bit boundary),
388FAXMODE_WORDALIGN
389(align each encoded row to an 16-bit boundary),
390The default value is dependent on the compression scheme; this
391pseudo-tag is used by the various G3 and G4 codecs to share code.
392.TP
393.B TIFFTAG_FAXFILLFUNC
394Control the function used to convert arrays of black and white
395runs to packed bit arrays.
396This hook can be used to image decoded scanlines in multi-bit
397depth rasters (e.g. for display in colormap mode)
398or for other purposes.
399The default value is a pointer to a builtin function that images
400packed bilevel data.
401.TP
402.B TIFFTAG_IPTCNEWSPHOTO
403Tag contaings image metadata per the IPTC newsphoto spec: Headline,
404captioning, credit, etc... Used by most wire services.
405.TP
406.B TIFFTAG_PHOTOSHOP
407Tag contains Photoshop captioning information and metadata. Photoshop
408uses in parallel and redundantly alongside IPTCNEWSPHOTO information.
409.TP
410.B TIFFTAG_JPEGQUALITY
411Control the compression quality level used in the baseline algorithm.
412Note that quality levels are in the range 0-100 with a default value of 75.
413.TP
414.B TIFFTAG_JPEGCOLORMODE
415Control whether or not conversion is done between
416RGB and YCbCr colorspaces.
417Possible values are:
418JPEGCOLORMODE_RAW
419(do not convert), and
420JPEGCOLORMODE_RGB
421(convert to/from RGB)
422The default value is JPEGCOLORMODE_RAW.
423.TP
424.B TIFFTAG_JPEGTABLESMODE
425Control the information written in the
426.I JPEGTables
427tag.
428Possible values (independent bits that can be combined by
429or'ing them together) are:
430JPEGTABLESMODE_QUANT
431(include quantization tables),
432and
433JPEGTABLESMODE_HUFF
434(include Huffman encoding tables).
435The default value is JPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF.
436.TP
437.B TIFFTAG_ZIPQUALITY
438Control the compression technique used by the Deflate codec.
439Quality levels are in the range 1-9 with larger numbers yielding better
440compression at the cost of more computation.
441The default quality level is 6 which yields a good time-space tradeoff.
442.TP
443.B TIFFTAG_PIXARLOGDATAFMT
444Control the format of user data passed
445.I in
446to the PixarLog codec when encoding and passed
447.I out
448from when decoding.
449Possible values are:
450PIXARLOGDATAFMT_8BIT
451for 8-bit unsigned pixels,
452PIXARLOGDATAFMT_8BITABGR
453for 8-bit unsigned ABGR-ordered pixels,
454PIXARLOGDATAFMT_11BITLOG
455for 11-bit log-encoded raw data,
456PIXARLOGDATAFMT_12BITPICIO
457for 12-bit PICIO-compatible data,
458PIXARLOGDATAFMT_16BIT
459for 16-bit signed samples,
460and
461PIXARLOGDATAFMT_FLOAT
462for 32-bit IEEE floating point samples.
463.TP
464.B TIFFTAG_PIXARLOGQUALITY
465Control the compression technique used by the PixarLog codec.
466This value is treated identically to TIFFTAG_ZIPQUALITY; see the
467above description.
468.TP
469.B TIFFTAG_SGILOGDATAFMT
470Control the format of client data passed
471.I in
472to the SGILog codec when encoding and passed
473.I out
474from when decoding.
475Possible values are:
476SGILOGDATAFMT_FLTXYZ
477for converting between LogLuv and 32-bit IEEE floating valued XYZ pixels,
478SGILOGDATAFMT_16BITLUV
479for 16-bit encoded Luv pixels,
480SGILOGDATAFMT_32BITRAW and SGILOGDATAFMT_24BITRAW
481for no conversion of data,
482SGILOGDATAFMT_8BITRGB
483for returning 8-bit RGB data (valid only when decoding LogLuv-encoded data),
484SGILOGDATAFMT_FLTY
485for converting between LogL and 32-bit IEEE floating valued Y pixels,
486SGILOGDATAFMT_16BITL
487for 16-bit encoded L pixels,
488and
489SGILOGDATAFMT_8BITGRY
490for returning 8-bit greyscale data
491(valid only when decoding LogL-encoded data).
492.SH DIAGNOSTICS
493All error messages are directed through the
494.IR TIFFError
495routine.
496By default messages are directed to
497.B stderr
498in the form:
499.IR "module: message\en."
500Warning messages are likewise directed through the
501.IR TIFFWarning
502routine.
503.SH "SEE ALSO"
504.BR fax2tiff (1),
505.BR gif2tiff (1),
506.BR pal2rgb (1),
507.BR ppm2tiff (1),
508.BR rgb2ycbcr (1),
509.BR ras2tiff (1),
510.BR raw2tiff (1),
511.BR sgi2tiff (1),
512.BR tiff2bw (1),
513.BR tiffdither (1),
514.BR tiffdump (1),
515.BR tiffcp (1),
516.BR tiffcmp (1),
517.BR tiffgt (1),
518.BR tiffinfo (1),
519.BR tiffmedian (1),
520.BR tiffsplit (1),
521.BR tiffsv (1).
522.PP
523.BR "Tag Image File Format Specification \(em Revision 6.0" ,
524an Aldus Technical Memorandum.
525.PP
526.BR "The Spirit of TIFF Class F" ,
527an appendix to the TIFF 5.0 specification prepared by Cygnet Technologies.
528.PP
529Libtiff library home page:
530.BR http://www.remotesensing.org/libtiff/
531.SH BUGS
532The library does not support multi-sample images
533where some samples have different bits/sample.
534.PP
535The library does not support random access to compressed data
536that is organized with more than one row per tile or strip.