INTRO(3T) UNIX System V(June 18, 1991) INTRO(3T)
NAME
intro - introduction to libtiff, a library for reading and writing TIFF
files
SYNOPSIS
#include <tiffio.h>
cc file.c -ltiff
DESCRIPTION
Libtiff is a library for reading and writing data files encoded with the
Tag Image File format, Revision 5.0. This file format is suitable for
archiving multi-color and monochromatic image data.
The library supports several compression algorithms, as indicated by the
Compression field, including: no compression (1), CCITT 1D Huffman
compression (2), CCITT Group 3 Facsimile compression (3), CCITT Group 4
Facsimile compression (4), Lempel-Ziv & Welch compression (5), word-
aligned 1D Huffman compression (32771), and PackBits compression (32773).
In addition, several nonstandard compression algorithms are supported:
the 4-bit compression algorithm used by the ThunderScan program (32809)
(decompression only), Pixar's Picio compression scheme (32900), Silicon
Graphics' compression scheme (32901), and NeXT's 2-bit compression
algorithm (32766) (decompression only). Directory information may be in
either little- or big-endian byte order-byte swapping is automatically
done by the library. Data bit ordering may be either Most Significant
Bit (MSB) to Least Significant Bit (LSB) or LSB to MSB. Data may not have
more than four samples per pixel. Finally, the library does not support
files in which the BitsPerSample, Compression, MinSampleValue, or
MaxSampleValue fields are defined differently on a per-sample basis (in
Rev. 5.0 the Compression tag is not defined on a per-sample basis, so
this is immaterial).
In addition to the nonstandard compression schemes, the library also
supports one other nonstandard facility: a Matteing field (32995) that
indicates whether or not sample SamplesPerPixel-1 in each pixel holds
Alpha (matteing) data. When Alpha data is present, associated sample
data are assumed to be pre-multiplied by Alpha. (The Matteing tag is a
registered private tag that has been assigned to Silicon Graphics.)
LIST OF ROUTINES
The following routines are available. Consult specific manual pages for
details on their operation.
Name Appears on Page Description
TIFFCheckTile tile.3t very x,y,z,sample is within image
TIFFClose close.3t close an open file
TIFFComputeTile tile.3t return tile containing x,y,z,sample
TIFFCurrentRow query.3t return index of current scanline
TIFFCurrentStrip query.3t return index of current strip
TIFFCurrentTile query.3t return index of current tile
TIFFError error.3t library error handler
TIFFFdOpen open.3t open a file for reading or writing
TIFFFileno query.3t return open file descriptor
10/89 Page 1
INTRO(3T) UNIX System V(June 18, 1991) INTRO(3T)
TIFFFileName query.3t return name of open file
TIFFFlush flush.3t flush all pending writes
TIFFFlushData flush.3t flush pending data writes
TIFFGetField getfield.3t return tag value in current directory
TIFFGetMode query.3t return open file mode
TIFFIsTiled query.3t return true if image data is tiled
TIFFOpen open.3t open a file for reading or writing
TIFFReadBufferSetup rdbuf.3t specify i/o buffer for reading
TIFFReadDirectory readdir.3t read the next directory
TIFFReadEncodedStrip rdestrip.3t read and decode a strip of data
TIFFReadRawStrip rdrstrip.3t read a raw strip of data
TIFFReadEncodedTile rdetile.3t read and decode a tile of data
TIFFReadRawTile rdrtile.3t read a raw tile of data
TIFFReadScanline readline.3t read and decode a row of data
TIFFReadTile readtile.3t read and decode a tile of data
TIFFReverseBits swab.3t reverse bits in an array of bytes
TIFFScanlineSize size.3t return size of a scanline
TIFFSetDirectory setdir.3t set the current directory
TIFFSetField setfield.3t set a tag's value in the current directory
TIFFSwabShort swab.3t swap bytes of short
TIFFSwabLong swab.3t swap bytes of long
TIFFSwabArrayOfShort swab.3t swap bytes of an array of shorts
TIFFSwabArrayOfLong swab.3t swap bytes of an array of longs
TIFFTileSize size.3t return size of a tile
TIFFVGetField getfield.3t return tag value in current directory
TIFFVSetField setfield.3t set a tag's value in the current directory
TIFFWarning warning.3t library warning handler
TIFFWriteDirectory writedir.3t write the current directory
TIFFWriteEncodedStrip wrestrip.3t compress and write a strip of data
TIFFWriteRawStrip wrrstrip.3t write a raw strip of data
TIFFWriteEncodedTile wretile.3t compress and write a tile of data
TIFFWriteRawTile wrrtile.3t write a raw tile of data
TIFFWriteScanline writeline.3t write a scanline of data
TIFFWriteTile wrrtile.3t compress and write a tile of data
TAG USAGE
The table below lists the TIFF tags that are recognized and handled by
the library. If no use is indicated in the table, then the library reads
and writes the tag, but does not use it internally.
Tag Name Value R/W Library's Use
Artist 315 R/W
BadFaxLines 326 R/W
BitsPerSample 258 R/W lots
CellLength 265 parsed but ignored
CellWidth 264 parsed but ignored
CleanFaxData 327 R/W
ColorMap 320 R/W
ColorResponseCurves 301 R/W
ColorResponseUnit 300 R/W
Compression 259 R/W choosing compression routines
ConsecutiveBadFaxLines 328 R/W
DataType 32996 R/W
Page 2 10/89
INTRO(3T) UNIX System V(June 18, 1991) INTRO(3T)
DateTime 306 R/W
DocumentName 269 R/W
FillOrder 266 R/W control bit order
FreeByteCounts 289 parsed but ignored
FreeOffsets 288 parsed but ignored
GrayResponseCurve 291 R/W
GrayResponseUnit 290 R/W
Group3Options 292 R/W used by Group 3 code
Group4Options 293 R/W
HostComputer 316 R/W
ImageDescription 270 R/W
ImageDepth 32997 R/W lots
ImageLength 257 R/W lots
ImageWidth 256 R/W lots
InkSet 332 R/W
JPEGProc 33603 R/W used by JPEG code
JPEGQTablePrecision 33605 R/W used by JPEG code
JPEGQTables 33606 R/W used by JPEG code
JPEGDCTables 33607 R/W used by JPEG code
JPEGACTables 33608 R/W used by JPEG code
LumaCoefs 33611 R/W
YCbCrSampling 33612 R/W
Make 271 R/W
Matteing 32995 R/W used by picio code
MaxSampleValue 281 R/W
MinSampleValue 280 R/W
Model 272 R/W
NewSubFileType 254 R/W
Orientation 274 R/W
PageName 285 R/W
PageNumber 297 R/W
PhotometricInterpretation 262 R/W Group 3 code
PlanarConfiguration 284 R/W data i/o
Predictor 317 R/W used by LZW code
PrimaryChromaticities 319 parsed but ignored
ResolutionUnit 296 R/W
RowsPerStrip 278 R/W data i/o
SamplesPerPixel 277 R/W lots
Software 305 R/W
StripByteCounts 279 R/W data i/o
StripOffsets 273 R/W data i/o
SubFileType 255 R/W
Thresholding 263 R/W
TileWidth 322 R/W tiled interfaces
TileLength 323 R/W tiled interfaces
TileDepth 32998 R/W tiled interfaces
WhitePoint 318 parsed but ignored
XPosition 286 R/W
XResolution 282 R/W
YPosition 286 R/W
YResolution 283 R/W used by Group 3 2d encoding
10/89 Page 3
INTRO(3T) UNIX System V(June 18, 1991) INTRO(3T)
DIAGNOSTICS
All error messages are directed to the TIFFError() routine which may be
redefined by applications to redirect messages. By default messages are
directed to stderr in the form: module: message\n. Warning messages are
likewise directed to the TIFFWarning() routine.
SEE ALSO
fax2tiff(1), tiff2bw(1), tiffdither(1), tiffdump(1), tiffcp(1),
tiffcmp(1), tiffgt(1), tiffinfo(1), tiffmedian(1), tiffsv(1),
Tag Image File Format Specification - Revision 5.0, an Aldus/Microsoft
Technical Memorandum, August 8, 1988.
The Spirit of TIFF Class F, an appendix to the TIFF 5.0 specification
prepared by Cygnet Technologies.
BUGS
It is not possible to overwrite the contents of a strip with
TIFFWriteEncodedStrip() and TIFFWriteRawStrip() since they append to a
strip. Likewise, TIFFWriteEncodedTile() and TIFFWriteRawTile() append to
a tile. The library does not support random access to compressed data
that is organized with more than one row or tile per strip. The library
does not handle unknown tags (perhaps it should just save them for the
application?). The library does not do enough validity checking of a
directory's contents.
Page 4 10/89