Solaris  - libtiff (3)

NAME

libtiff - introduction to libtiff, a library for reading and writing TIFF files

CONTENTS

SYNOPSIS

#include <tiffio.h>

cc [ flag ...] -I/usr/sfw/include       file [ library ...  ]         -L/usr/sfw/lib -R/usr/sfw/lib -ltiff

advertisement

advertisement


DESCRIPTION

libtiff is a library for reading and writing data files encoded with the Tag Image File format, Revision 4.0 or later. The TIFF file format is suitable for archiving multicolor and monochromatic image data.

EXTENDED DESCRIPTION

The libtiff library supports several compression algorithms, as indicated by the Compression field, including:

o No compression (1)

o CCITT 1D Huffman compression (2)

o CCITT Group 3 Facsimile compression (3)

o CCITT Group 4 Facsimile compression (4)

o Lempel-Ziv & Welch compression (5)

o Baseline JPEG compression (7)

o Word-aligned 1D Huffman compression (32771)

o PackBits compression (32773)

In addition, several nonstandard compression algorithms are supported:

o 4-bit compression algorithm used by the ThunderScan program (32809) (decompression only)

o NeXT’s 2-bit compression algorithm (32766) (decompression only)

o Experimental LZ-style algorithm known as Deflate (32946)

o Experimental CIE LogLuv compression scheme designed for images with high dynamic range (32845 for LogL and 32845 for LogLuv)

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.

The library does not support files in which the BitsPerSample, Compression, MinSampleValue, or MaxSampleValue fields are defined differently on a per-sample basis. In Revision 6.0, the Compression tag is not defined on a per-sample basis, so this is immaterial.

    Data Types

The libtiff library makes extensive use of C typedefs to promote portability. Two sets of typedefs are used, one for communication with clients of the library and one for internal data structures and parsing of the TIFF format. The following typedefs are exposed to users either through function definitions or through parameters passed through the varargs interfaces.

o typedef unsigned short uint16; — 16-bit unsigned integer

o typedef unsigned <thing> uint32; — 32-bit unsigned integer

o typedef unsigned int ttag_t; — directory tag

o typedef uint16 tdir_t; — directory index

o typedef uint16 tsample_t; — sample number

o typedef uint32 tstrip_t; — strip number

o typedef uint32 ttile_t; — tile number

o typedef int32 tsize_t; — i/o size in bytes

o typedef void* tdata_t; — image data ref

o typedef void* thandle_t; — client data handle

o typedef int32 toff_t; — file offset

tstrip_t, ttile_t, and tsize_t are limited to 32-bit quantities because they are stored in 32-bit fields in the TIFF image. Similarly, tsample_t is limited by the 16-bit field used to store the SamplesPerPixel tag. tdir_t constrains the maximum number of IFDs that may appear in an image and may be an arbitrary size without penalty.

ttag_t must be int, unsigned int, pointer, or double because the library uses a varargs interface and ANSI C restricts the type of the parameter before an ellipsis to be a promoted type.

toff_t is defined as int32 because TIFF file offsets are unsigned 32-bit quantities. A signed value is used because some interfaces return -1 on error.

User-specified data references are passed as opaque handles and only cast at the lowest layers where their type is presumed.

    Library Routines

The following routines are part of the libtiff library. Consult specific reference pages for details on their operation. The reference page names listed below are for systems where the full function names cannot be encoded in the file system. On most systems, the command man function-name will work.

_TIFFfree Release allocated memory. See TIFFmemory(3tiff).

_TIFFmalloc Dynamically allocate memory. See TIFFmemory(3tiff).

_TIFFmemcmp Compare allocated memory. See TIFFmemory(3tiff).

_TIFFmemcpy Copy allocated memory to another memory location. See TIFFmemory(3tiff).

_TIFFmemset Set allocated memory to known value. See TIFFmemory(3tiff).

_TIFFrealloc Dynamically reallocate memory. See TIFFmemory(3tiff).

TIFFbuffer Specify i/o buffer for reading or writing. See TIFFbuffer(3tiff).

TIFFCheckTile Every x,y,z,sample is within image. See TIFFtile(3tiff).

TIFFClientOpen Open a file for reading or writing. See TIFFOpen(3tiff).

TIFFClose Close an open file. See TIFFClose(3tiff).

TIFFcodec Work with codecs. See TIFFcodec(3tiff).

TIFFComputeStrip Return strip containing x,y,z,sample. See TIFFstrip(3tiff).

TIFFComputeTile Return tile containing y,sample. See TIFFtile(3tiff).

TIFFCurrentDirectory Return index of current directory. See TIFFquery(3tiff).

TIFFCurrentRow Return index of current scanline. See TIFFquery(3tiff).

TIFFCurrentStrip Return index of current strip. See TIFFquery(3tiff).

TIFFCurrentTile Return index of current tile. See TIFFquery(3tiff).

TIFFDefaultStripSize Return size of a strip. See TIFFstrip(3tiff).

TIFFDefaultTileSize Return size of a tile. See TIFFtile(3tiff).

TIFFError Library error handler. See TIFFError(3tiff).

TIFFFdOpen Open a file for reading or writing. See TIFFOpen(3tiff).

TIFFFileName Return name of open file. See TIFFquery(3tiff).

TIFFFileno Return open file descriptor. See TIFFquery(3tiff).

TIFFFindCODEC Find a codec. See TIFFcodec(3tiff).

TIFFFlush Flush all pending writes. See TIFFFlush(3tiff).

TIFFFlushData Flush pending data writes. See TIFFFlush(3tiff).

TIFFGetBitRevTable Return bit reversal table. See TIFFswab(3tiff).

TIFFGetField Return tag value in current directory. See TIFFGetField(3tiff).

TIFFGetFieldDefaulted Return tag value in current directory. See TIFFGetField(3tiff).

TIFFGetMode Return open file mode. See TIFFquery(3tiff).

TIFFGetVersion Return library version string. See TIFFquery(3tiff).

TIFFIsByteSwapped Return true if image data is byte-swapped. See TIFFquery(3tiff).

TIFFIsMSB2LSB Return true if image data is returned with bit 0 as the most significant bit. See TIFFquery(3tiff).

TIFFIsTiled Return true if image data is tiled. See TIFFquery(3tiff).

TIFFIsUpSampled Return true if image data is up-sampled. See TIFFquery(3tiff).

TIFFLastDirectory Return a non-zero value if the current directory is the last directory in the file. See TIFFquery(3tiff).

TIFFmemory Manage memory. See TIFFmemory(3tiff).

TIFFNumberOfStrips Return number of strips in an image. See TIFFstrip(3tiff).

TIFFNumberOfTiles Return number of tiles in an image. See TIFFtile(3tiff).

TIFFOpen Open a file for reading or writing. See TIFFOpen(3tiff).

TIFFPrintDirectory Print description of the current directory. See TIFFPrintDirectory(3tiff).

TIFFquery Return information about image. See TIFFquery(3tiff).

TIFFRasterScanlineSize Return size of a raster scanline. See TIFFsize(3tiff).

TIFFReadBufferSetup Specify i/o buffer for reading. See TIFFbuffer(3tiff).

TIFFReadDirectory Read the next directory. See TIFFReadDirectory(3tiff).

TIFFReadEncodedStrip Read and decode a strip of data. See TIFFReadEncodedStrip(3tiff).

TIFFReadEncodedTile Read and decode a tile of data. See TIFFReadEncodedTile(3tiff).

TIFFReadRawStrip Read a raw strip of data. See TIFFReadRawStrip(3tiff).

TIFFReadRawTile Read a raw tile of data. See TIFFReadRawTile(3tiff).

TIFFReadRGBAImage Read an image into a fixed format raster. See TIFFReadRGBAImage(3tiff).

TIFFReadRGBAStrip Read an image strip into a fixed format raster. See TIFFReadRGBAStrip(3tiff).

TIFFReadRGBATile Read an image tile into a fixed format raster. See TIFFReadRGBATile(3tiff).

TIFFReadScanline Read and decode a row of data. See TIFFReadScanline(3tiff).

TIFFReadTile Read and decode a tile of data. See TIFFReadTile(3tiff).

TIFFRegisterCODEC Register a codec. See TIFFcodec(3tiff).

TIFFReverseBits Reverse bits in an array of bytes. See TIFFswab(3tiff).

TIFFRGBAImage Read and decode an image into a raster. See TIFFRGBAImage(3tiff).

TIFFRGBAImageBegin Set up decoder state for TIFFRGBAImageGet. See TIFFRGBAImage(3tiff).

TIFFRGBAImageEnd Release TIFFRGBAImage decoder state. See TIFFRGBAImage(3tiff).

TIFFRGBAImageGet Read and decode an image. See TIFFRGBAImage(3tiff).

TIFFRGBAImageOK Determine whether image is readable by TIFFRGBAImageGet. See TIFFRGBAImage(3tiff).

TIFFScanlineSize Return size of a scanline. See TIFFsize(3tiff).

TIFFSetDirectory Set the current directory. See TIFFSetDirectory(3tiff).

TIFFSetSubDirectory Set the current directory. See TIFFSetDirectory(3tiff).

TIFFSetErrorHandler Set error handler function. See TIFFError(3tiff).

TIFFSetField Set tag value in the current directory. See TIFFSetField(3tiff).

TIFFSetWarningHandler Set warning handler function. See TIFFWarning(3tiff).

TIFFsize Return the size. See TIFFsize(3tiff).

TIFFstrip Work with strips. See TIFFstrip(3tiff).

TIFFStripSize Return size of a strip. See TIFFstrip(3tiff).

TIFFswab Swap bytes. See TIFFswab(3tiff).

TIFFSwabShort Swap bytes of short. See TIFFswab(3tiff).

TIFFSwabLong Swap bytes of long. See TIFFswab(3tiff).

TIFFSwabArrayOfShort Swap bytes of an array of shorts. See TIFFswab(3tiff).

TIFFSwabArrayOfLong Swap bytes of an array of longs. See TIFFswab(3tiff).

TIFFtile Return tile information. See TIFFtile(3tiff).

TIFFTileRowSize Return size of a row in a tile. See TIFFtile(3tiff).

TIFFTileSize Return size of a tile. See TIFFtile(3tiff).

TIFFUnregisterCODEC Unregister a codec. See TIFFcodec(3tiff).

TIFFVGetField Return tag value in current directory. See TIFFGetField(3tiff).

TIFFVGetFieldDefaulted Return tag value in current directory. See TIFFGetField(3tiff).

TIFFVSetField Set tag value in current directory. See TIFFSetField(3tiff).

TIFFVStripSize Return size of a strip. See TIFFstrip(3tiff).

TIFFVTileSize Return size of a tile. See TIFFtile(3tiff).

TIFFWarning Library warning handler. See TIFFWarning(3tiff).

TIFFWriteBufferSetup Specify i/o buffer for writing. See TIFFbuffer(3tiff).

TIFFWriteDirectory Write the current directory. See TIFFWriteDirectory(3tiff).

TIFFWriteEncodedStrip Compress and write a strip of data. See TIFFWriteEncodedStrip(3tiff).

TIFFWriteEncodedTile Compress and write a tile of data. See TIFFWriteEncodedTile(3tiff).

TIFFWriteRawStrip Write a raw strip of data. See TIFFWriteRawStrip(3tiff).

TIFFWriteRawTile Write a raw tile of data. See TIFFWriteRawTile(3tiff).

TIFFWriteScanline Write a scanline of data. See TIFFWriteScanline(3tiff).

TIFFWriteTile Compress and write a tile of data. See TIFFWriteTile(3tiff).

    Tag Usage

The table below lists the TIFF tags that are recognized and supported by the libtiff library. If no use is indicated in the table, then the library reads and writes the tag, but does not use the tag internally. Note that some tags are meaningful only when a particular compression scheme is used. For example, Group3Options is only useful if Compression is set to CCITT Group 3 encoding. Tags of this sort are considered codec-specific tags and the library does not recognize them except when the Compression tag has been previously set to the relevant compression scheme.

TAG NAMEVALUER/WLIBRARY USE / NOTES
Artist315R/W 
BadFaxLines326R/W 
BitsPerSample258R/WLots.
CellLength265 Parsed but ignored.
CellWidth264 Parsed but ignored.
CleanFaxData327R/W 
ColorMap320R/W 
ColorResponseUnit300 Parsed but ignored.
Compression259R/WChoosing codec.
ConsecutiveBadFaxLines328R/W 
DataType32996RObsoleted by SampleFormat tag.
DateTime306R/W 
DocumentName269R/W 
DotRange336R/W 
ExtraSamples338R/WLots.
FaxRecvParams34908R/W 
FaxSubAddress34909R/W 
FaxRecvTime34910R/W 
FillOrder266R/WControl bit order.
FreeByteCounts289 Parsed but ignored.
FreeOffsets288 Parsed but ignored.
GrayResponseCurve291 Parsed but ignored.
GrayResponseUnit290 Parsed but ignored.
Group3Options292R/WUsed
by Group 3 codec.   
Group4Options293R/W 
HostComputer316R/W 
ImageDepth32997R/WTile/strip
calculations.   
ImageDescription270R/W 
ImageLength257R/WLots.
ImageWidth256R/WLots.
InkNames333R/W 
InkSet332R/W 
JPEGTables347R/WUsed
by JPEG codec.   
Make271R/W 
Matteing32995RObsoleted
by ExtraSamples tag.   
MaxSampleValue281R/W 
MinSampleValue280R/W 
Model272R/W 
NewSubFileType254R/WCalled SubFileType in spec.
NumberOfInks334R/W 
Orientation274R/W 
PageName285R/W 
PageNumber297R/W 
PhotometricInterpretation262R/WUsed
by Group 3 and JPEG codecs.   
PlanarConfiguration284R/WData
i/o.   
Predictor317R/WUsed
by LZW and Deflate codecs.   
PrimaryChromacities319R/W 
ReferenceBlackWhite532R/W 
ResolutionUnit296R/WUsed
by Group 3 codec.   
RowsPerStrip278R/WData
i/o.   
SampleFormat339R/W 
SamplesPerPixel277R/WLots.
SMinSampleValue340R/W 
SMaxSampleValue341R/W 
Software305R/W 
StoNits37439R/W 
StripByteCounts279R/WData
i/o.   
StripOffsets273R/WData
i/o.   
SubFileType255R/WCalled OSubFileType in spec.
TargetPrinter337R/W 
Thresholding263R/W 
TileByteCounts324R/WData
i/o.   
TileDepth32998R/WTile/strip
calculations.   
TileLength323R/WData
i/o.   
TileOffsets324R/WData
i/o.   
TileWidth322R/WData
i/o.   
TransferFunction301R/W 
WhitePoint318R/W 
XPosition286R/W 
XResolution282R/W 
YCbCrCoefficients529R/WUsed
by TIFFRGBAImage support.   
YCbCrPositioning531R/WTile/strip
size calulcations.   
YCbCrSubsampling530R/W 
YPosition286R/W 
YResolution283R/WUsed
by Group 3 codec.   

    Pseudo Tags

In addition to the normal TIFF tags, the libtiff library supports a collection of tags whose values lie in a range outside the valid range of TIFF tags. These tags are termed pseudo-tags and are used to control various codec-specific functions within the library. The table below summarizes the defined pseudo-tags.

TAG NAMECODECR/WLIBRARY USE / NOTES
TIFFTAG_FAXMODEG3R/WGeneral codec operation.
TIFFTAG_FAXFILLFUNCG3/G4R/WBitmap fill function.
TIFFTAG_JPEGQUALITYJPEGR/WCompression quality control.
TIFFTAG_JPEGCOLORMODEJPEGR/WControl colorspace conversions.
TIFFTAG_JPEGTABLESMODEJPEGR/WControl contents of JPEGTables tag.
TIFFTAG_ZIPQUALITYDeflateR/WCompression quality level.
TIFFTAG_PIXARLOGDATAFMTPixarLogR/WUser data format.
TIFFTAG_PIXARLOGQUALITYPixarLogR/WCompression quality level.
TIFFTAG_SGILOGDATAFMTSGILogR/WUser data format.

    TIFFTAG_FAXMODE

Controls the operation of the Group 3 codec. Possible values (independent bits that can be combined by or’ing them together) are:

FAXMODE_BYTEALIGN Align each encoded row to an 8-bit boundary.

FAXMODE_CLASSIC Enable old-style format in which the RTC is written at the end of the last strip.

FAXMODE_NOEOL Do not write EOL codes at the start of each row of data.

FAXMODE_NORTC, also called FAXMODE_CLASSF Opposite of FAXMODE_CLASSIC.

FAXMODE_WORDALIGN Align each encoded row to a 16-bit boundary.

The default value depends on the compression scheme. This pseudo-tag is used by the various G3 and G4 codecs to share code.

    TIFFTAG_FAXFILLFUNC

Controls the function used to convert arrays of black and white runs to packed bit arrays. This hook can be used to image decoded scanlines in multi-bit depth rasters (for example, for display in colormap mode) or for other purposes. The default value is a pointer to a builtin function that images packed bilevel data.

    TIFFTAG_IPTCNEWSPHOTO

Contains image metadata per the IPTC newsphoto specification: Headline, captioning, credit, and so on. Used by most wire services.

    TIFFTAG_PHOTOSHOP

Contains Photoshop captioning information and metadata. Photoshop uses in parallel and redundantly alongside IPTCNEWSPHOTO information.

    TIFFTAG_JPEGQUALITY

Controls the compression quality level used in the baseline algorithm. Note that quality levels are in the range 0-100 with a default value of 75.

    TIFFTAG_JPEGCOLORMODE

Controls whether or not conversion is done between RGB and YCbCr colorspaces. Possible values are: JPEGCOLORMODE_RAW (do not convert), and JPEGCOLORMODE_RGB (convert to/from RGB). The default value is JPEGCOLORMODE_RAW.

    TIFFTAG_JPEGTABLESMODE

Controls the information written in the JPEGTables tag. Possible values (independent bits that can be combined by or’ing them together) are: JPEGTABLESMODE_QUANT (include quantization tables), and JPEGTABLESMODE_HUFF (include Huffman encoding tables).

    TIFFTAG_ZIPQUALITY

Controls the compression technique used by the Deflate codec. Quality levels are in the range 1-9 with larger numbers yielding better compression at the cost of more computation. The default quality level is 6 which yields a good time-space tradeoff.

    TIFFTAG_PIXARLOGDATAFMT

Controls the format of user data passed to the PixarLog codec when encoding and passed from the PixarLog codec when decoding. Possible values are:

o PIXARLOGDATAFMT_8BIT for 8-bit unsigned pixels

o PIXARLOGDATAFMT_8BITABGR for 8-bit unsigned ABGR-orderedpixels

o PIXARLOGDATAFMT_11BITLOG for 11-bit log-encoded raw data

o PIXARLOGDATAFMT_12BITPICIO for 12-bit PICIO-compatible data

o PIXARLOGDATAFMT_16BIT for 16-bit signed samples

o PIXARLOGDATAFMT_FLOAT for 32-bit IEEE floating point samples

    TIFFTAG_PIXARLOGQUALITY

Controls the compression technique used by the PixarLog codec. This value is treated identically to TIFFTAG_ZIPQUALITY.

    TIFFTAG_SGILOGDATAFMT

Controls the format of client data passed to the SGILog codec when encoding and passed from the SGILog codec when decoding. Possible values are:

o SGILOGDATAFMT_FLTXYZ for converting between LogLuv and 32-bit IEEE floating valued XYZ pixels

o SGILOGDATAFMT_16BITLUV for 16-bit encoded Luv pixels

o SGILOGDATAFMT_32BITRAW and SGILOGDATAFMT_24BITRAW for no conversion of data

o SGILOGDATAFMT_8BITRGB for returning 8-bit RGB data (valid only when decoding LogLuv-encoded data)

o SGILOGDATAFMT_FLTY for converting between LogL and 32-bit IEEE floating valued Y pixels

o SGILOGDATAFMT_16BITL for 16-bit encoded L pixels

o SGILOGDATAFMT_8BITGRY for returning 8-bit greyscale data (valid only when decoding LogL-encoded data)

    Diagnostics

All error messages are directed through the TIFFError routine. By default, messages are directed to stderr in the form: module: message\n. Warning messages are likewise directed through the TIFFWarning routine.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
AvailabilitySUNWTiff
Interface stabilityEvolving

SEE ALSO

fax2tiff(1), gif2tiff(1), pal2rgb(1), ppm2tiff(1), ras2tiff(1), rgb2ycbcr(1), sgi2tiff(1); tiff2bw(1); tiffcmp(1); tiffcp(1); tiffdither(1); tiffdump(1); tiffgt(1); tiffinfo(1); tiffmedian(1); tiffsplit(1); tiffsv(1)

Tag Image File Format Specification Revision 6.0, an Aldus Technical Memorandum.

The Spirit of TIFF Class F an appendix to the TIFF 5.0 specification prepared by Cygnet Technologies.

NOTES

The libtiff library does not support multisample images where some samples have different bits/sample.

The library does not support random access to compressed data that is organized with more than one row per tile or strip. The library discards unknown tags. The library should do more validity checking of a directory’s contents.

This man page was originally written by Sam Leffler. Updated by Breda McColgan, Sun Microsystems Inc., 2004.

Jump to page    or go to Top of page |  Section 3 |  OpenSolaris Man Main Index.


SunOS 5.11 libtiff (3) 06 Apr 2004
Generated by OpenSolaris Forum from /usr/share/man/man3/libtiff.3 using man macros with tbl support.