kusano 7d535a
.\" $Id: TIFFGetField.3tiff,v 1.6 2012-05-19 23:15:22 bfriesen Exp $
kusano 7d535a
.\"
kusano 7d535a
.\" Copyright (c) 1988-1997 Sam Leffler
kusano 7d535a
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
kusano 7d535a
.\"
kusano 7d535a
.\" Permission to use, copy, modify, distribute, and sell this software and 
kusano 7d535a
.\" its documentation for any purpose is hereby granted without fee, provided
kusano 7d535a
.\" that (i) the above copyright notices and this permission notice appear in
kusano 7d535a
.\" all copies of the software and related documentation, and (ii) the names of
kusano 7d535a
.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
kusano 7d535a
.\" publicity relating to the software without the specific, prior written
kusano 7d535a
.\" permission of Sam Leffler and Silicon Graphics.
kusano 7d535a
.\" 
kusano 7d535a
.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
kusano 7d535a
.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
kusano 7d535a
.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
kusano 7d535a
.\" 
kusano 7d535a
.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
kusano 7d535a
.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
kusano 7d535a
.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
kusano 7d535a
.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
kusano 7d535a
.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
kusano 7d535a
.\" OF THIS SOFTWARE.
kusano 7d535a
.\"
kusano 7d535a
.if n .po 0
kusano 7d535a
.TH TIFFGetField 3TIFF "March 18, 2005" "libtiff"
kusano 7d535a
.SH NAME
kusano 7d535a
TIFFGetField, TIFFVGetField \- get the value(s) of a tag in an open
kusano 7d535a
.SM TIFF
kusano 7d535a
file
kusano 7d535a
.SH SYNOPSIS
kusano 7d535a
.B "#include <tiffio.h>"</tiffio.h>
kusano 7d535a
.sp
kusano 7d535a
.BI "int TIFFGetField(TIFF *" tif ", ttag_t " tag ", " ... ")"
kusano 7d535a
.sp
kusano 7d535a
.B "#include <stdarg.h>"</stdarg.h>
kusano 7d535a
.sp
kusano 7d535a
.BI "int TIFFVGetField(TIFF *" tif ", ttag_t " tag ", va_list " ap ")"
kusano 7d535a
.br
kusano 7d535a
.BI "int TIFFGetFieldDefaulted(TIFF *" tif ", ttag_t " tag ", " ... ")"
kusano 7d535a
.br
kusano 7d535a
.BI "int TIFFVGetFieldDefaulted(TIFF *" tif ", ttag_t " tag ", va_list " ap ")"
kusano 7d535a
.SH DESCRIPTION
kusano 7d535a
.IR TIFFGetField
kusano 7d535a
returns the value of a tag or pseudo-tag associated with the the current
kusano 7d535a
directory of the opened
kusano 7d535a
.SM TIFF
kusano 7d535a
file
kusano 7d535a
.IR tif .
kusano 7d535a
(A
kusano 7d535a
.I pseudo-tag 
kusano 7d535a
is a parameter that is used to control the operation of the
kusano 7d535a
.SM TIFF
kusano 7d535a
library but whose value is not read or written to the underlying file.) The
kusano 7d535a
file must have been previously opened with
kusano 7d535a
.IR TIFFOpen (3TIFF).
kusano 7d535a
The tag is identified by
kusano 7d535a
.IR tag ,
kusano 7d535a
one of the values defined in the include file
kusano 7d535a
.B tiff.h
kusano 7d535a
(see also the table below). The type and number of values returned is
kusano 7d535a
dependent on the tag being requested. The programming interface uses a
kusano 7d535a
variable argument list as prescribed by the
kusano 7d535a
.IR stdarg (3)
kusano 7d535a
interface. The returned values should only be interpreted if
kusano 7d535a
.IR TIFFGetField
kusano 7d535a
returns 1.
kusano 7d535a
.PP
kusano 7d535a
.IR TIFFVGetField
kusano 7d535a
is functionally equivalent to
kusano 7d535a
.IR TIFFGetField
kusano 7d535a
except that it takes a pointer to a variable argument list.
kusano 7d535a
.I TIFFVGetField
kusano 7d535a
is useful for layering interfaces on top of the functionality provided by
kusano 7d535a
.IR TIFFGetField .
kusano 7d535a
.PP
kusano 7d535a
.IR TIFFGetFieldDefaulted
kusano 7d535a
and
kusano 7d535a
.IR TIFFVGetFieldDefaulted
kusano 7d535a
are identical to 
kusano 7d535a
.IR TIFFGetField
kusano 7d535a
and
kusano 7d535a
.IR TIFFVGetField ,
kusano 7d535a
except that if a tag is not defined in the current directory and it has a
kusano 7d535a
default value, then the default value is returned.
kusano 7d535a
.PP
kusano 7d535a
The tags understood by
kusano 7d535a
.IR libtiff(3TIFF),
kusano 7d535a
the number of parameter values, and the types for the returned values are
kusano 7d535a
shown below. The data types are specified as in C and correspond to the types
kusano 7d535a
used to specify tag values to
kusano 7d535a
.IR TIFFSetField (3TIFF).
kusano 7d535a
Remember that
kusano 7d535a
.IR TIFFGetField
kusano 7d535a
returns parameter values, so all the listed data types are pointers to storage
kusano 7d535a
where values should be returned.
kusano 7d535a
Consult the
kusano 7d535a
.SM TIFF
kusano 7d535a
specification (or relevant industry specification) for information on the
kusano 7d535a
meaning of each tag and their possible values.
kusano 7d535a
.PP
kusano 7d535a
.nf
kusano 7d535a
.ta \w'TIFFTAG_CONSECUTIVEBADFAXLINES'u+2n +\w'Count'u+2n +\w'TIFFFaxFillFunc*'u+2n
kusano 7d535a
\fITag Name\fP	\fICount\fP	\fITypes\fP	\fINotes\fP
kusano 7d535a
.sp 5p
kusano 7d535a
TIFFTAG_ARTIST	1	char**
kusano 7d535a
TIFFTAG_BADFAXLINES	1	uint32*
kusano 7d535a
TIFFTAG_BITSPERSAMPLE	1	uint16*
kusano 7d535a
TIFFTAG_CLEANFAXDATA	1	uint16*
kusano 7d535a
TIFFTAG_COLORMAP	3	uint16**	1<
kusano 7d535a
TIFFTAG_COMPRESSION	1	uint16*
kusano 7d535a
TIFFTAG_CONSECUTIVEBADFAXLINES	1	uint32*
kusano 7d535a
TIFFTAG_COPYRIGHT	1	char**
kusano 7d535a
TIFFTAG_DATATYPE	1	uint16*
kusano 7d535a
TIFFTAG_DATETIME	1	char**
kusano 7d535a
TIFFTAG_DOCUMENTNAME	1	char**
kusano 7d535a
TIFFTAG_DOTRANGE	2	uint16*
kusano 7d535a
TIFFTAG_EXTRASAMPLES	2	uint16*,uint16**	count & types array
kusano 7d535a
TIFFTAG_FAXFILLFUNC	1	TIFFFaxFillFunc*	G3/G4 compression pseudo-tag
kusano 7d535a
TIFFTAG_FAXMODE	1	int*	G3/G4 compression pseudo-tag
kusano 7d535a
TIFFTAG_FILLORDER	1	uint16*
kusano 7d535a
TIFFTAG_GROUP3OPTIONS	1	uint32*
kusano 7d535a
TIFFTAG_GROUP4OPTIONS	1	uint32*
kusano 7d535a
TIFFTAG_HALFTONEHINTS	2	uint16*
kusano 7d535a
TIFFTAG_HOSTCOMPUTER	1	char**
kusano 7d535a
TIFFTAG_ICCPROFILE	2	uint32*,void**	count, profile data
kusano 7d535a
TIFFTAG_IMAGEDEPTH	1	uint32*
kusano 7d535a
TIFFTAG_IMAGEDESCRIPTION	1	char**
kusano 7d535a
TIFFTAG_IMAGELENGTH	1	uint32*
kusano 7d535a
TIFFTAG_IMAGEWIDTH	1	uint32*
kusano 7d535a
TIFFTAG_INKNAMES	1	char**
kusano 7d535a
TIFFTAG_INKSET	1	uint16*
kusano 7d535a
TIFFTAG_JPEGCOLORMODE	1	int*	JPEG pseudo-tag
kusano 7d535a
TIFFTAG_JPEGQUALITY	1	int*	JPEG pseudo-tag
kusano 7d535a
TIFFTAG_JPEGTABLES	2	uint32*,void**	count & tables
kusano 7d535a
TIFFTAG_JPEGTABLESMODE	1	int*	JPEG pseudo-tag
kusano 7d535a
TIFFTAG_MAKE	1	char**
kusano 7d535a
TIFFTAG_MATTEING	1	uint16*
kusano 7d535a
TIFFTAG_MAXSAMPLEVALUE	1	uint16*
kusano 7d535a
TIFFTAG_MINSAMPLEVALUE	1	uint16*
kusano 7d535a
TIFFTAG_MODEL	1	char**
kusano 7d535a
TIFFTAG_ORIENTATION	1	uint16*
kusano 7d535a
TIFFTAG_PAGENAME	1	char**
kusano 7d535a
TIFFTAG_PAGENUMBER	2	uint16*
kusano 7d535a
TIFFTAG_PHOTOMETRIC	1	uint16*
kusano 7d535a
TIFFTAG_PHOTOSHOP	2	uint32*,void**	count, data
kusano 7d535a
TIFFTAG_PLANARCONFIG	1	uint16*
kusano 7d535a
TIFFTAG_PREDICTOR	1	uint16*
kusano 7d535a
TIFFTAG_PRIMARYCHROMATICITIES	1	float**	6-entry array
kusano 7d535a
TIFFTAG_REFERENCEBLACKWHITE	1	float**	6-entry array
kusano 7d535a
TIFFTAG_RESOLUTIONUNIT	1	uint16*
kusano 7d535a
TIFFTAG_RICHTIFFIPTC	2	uint32*,void**	count, data
kusano 7d535a
TIFFTAG_ROWSPERSTRIP	1	uint32*
kusano 7d535a
TIFFTAG_SAMPLEFORMAT	1	uint16*
kusano 7d535a
TIFFTAG_SAMPLESPERPIXEL	1	uint16*
kusano 7d535a
TIFFTAG_SMAXSAMPLEVALUE	1	double*
kusano 7d535a
TIFFTAG_SMINSAMPLEVALUE	1	double*
kusano 7d535a
TIFFTAG_SOFTWARE	1	char**
kusano 7d535a
TIFFTAG_STONITS	1	double**
kusano 7d535a
TIFFTAG_STRIPBYTECOUNTS	1	uint32**
kusano 7d535a
TIFFTAG_STRIPOFFSETS	1	uint32**
kusano 7d535a
TIFFTAG_SUBFILETYPE	1	uint32*
kusano 7d535a
TIFFTAG_SUBIFD	2	uint16*,uint32**	count & offsets array
kusano 7d535a
TIFFTAG_TARGETPRINTER	1	char**
kusano 7d535a
TIFFTAG_THRESHHOLDING	1	uint16*
kusano 7d535a
TIFFTAG_TILEBYTECOUNTS	1	uint32**
kusano 7d535a
TIFFTAG_TILEDEPTH	1	uint32*
kusano 7d535a
TIFFTAG_TILELENGTH	1	uint32*
kusano 7d535a
TIFFTAG_TILEOFFSETS	1	uint32**
kusano 7d535a
TIFFTAG_TILEWIDTH	1	uint32*
kusano 7d535a
TIFFTAG_TRANSFERFUNCTION	1 or 3\(dg	uint16**1<
kusano 7d535a
TIFFTAG_WHITEPOINT	1	float**	2-entry array
kusano 7d535a
TIFFTAG_XMLPACKET	2	uint32*,void**	count, data
kusano 7d535a
TIFFTAG_XPOSITION	1	float*
kusano 7d535a
TIFFTAG_XRESOLUTION	1	float*
kusano 7d535a
TIFFTAG_YCBCRCOEFFICIENTS	1	float**	3-entry array
kusano 7d535a
TIFFTAG_YCBCRPOSITIONING	1	uint16*
kusano 7d535a
TIFFTAG_YCBCRSUBSAMPLING	2	uint16*
kusano 7d535a
TIFFTAG_YPOSITION	1	float*
kusano 7d535a
TIFFTAG_YRESOLUTION	1	float*\(dd
kusano 7d535a
.fi
kusano 7d535a
\(dg If
kusano 7d535a
.I SamplesPerPixel
kusano 7d535a
is one, then a single array is returned; otherwise three arrays are returned.
kusano 7d535a
.fi
kusano 7d535a
\(dd The contents of this field are quite complex.  See 
kusano 7d535a
.IR "The ICC Profile Format Specification" ,
kusano 7d535a
Annex B.3 "Embedding ICC Profiles in TIFF Files" (available at
kusano 7d535a
http://www.color.org) for an explanation.
kusano 7d535a
.SH AUTOREGISTERED TAGS
kusano 7d535a
If you can't find the tag in the table above that means this is an unsupported
kusano 7d535a
tag and is not directly supported by
kusano 7d535a
.BR libtiff(3TIFF)
kusano 7d535a
library. You will still be able to read it's value if you know the data type of
kusano 7d535a
that tag. For example, if you want to read the LONG value from the tag 33424
kusano 7d535a
and ASCII string from the tag 36867 you can use the following code:
kusano 7d535a
.PP
kusano 7d535a
.RS
kusano 7d535a
.nf
kusano 7d535a
uint32  count;
kusano 7d535a
void    *data;
kusano 7d535a
kusano 7d535a
TIFFGetField(tiff, 33424, &count, &data);
kusano 7d535a
printf("Tag %d: %d, count %d\n", 33424, *(uint32 *)data, count);
kusano 7d535a
TIFFGetField(tiff, 36867, &count, &data);
kusano 7d535a
printf("Tag %d: %s, count %d\n", 36867, (char *)data, count);
kusano 7d535a
.fi
kusano 7d535a
.RE
kusano 7d535a
.PP
kusano 7d535a
.SH RETURN VALUES
kusano 7d535a
1 is returned if the tag is defined in the current directory; otherwise a 0 is
kusano 7d535a
returned.
kusano 7d535a
.SH DIAGNOSTICS
kusano 7d535a
All error messages are directed to the
kusano 7d535a
.BR TIFFError (3TIFF)
kusano 7d535a
routine.
kusano 7d535a
.PP
kusano 7d535a
.BR "Unknown field, tag 0x%x" .
kusano 7d535a
An unknown tag was supplied.
kusano 7d535a
.SH "SEE ALSO"
kusano 7d535a
.BR TIFFOpen (3TIFF),
kusano 7d535a
.BR TIFFSetField (3TIFF),
kusano 7d535a
.BR TIFFSetDirectory (3TIFF),
kusano 7d535a
.BR TIFFReadDirectory (3TIFF),
kusano 7d535a
.BR TIFFWriteDirectory (3TIFF)
kusano 7d535a
.BR libtiff (3TIFF),
kusano 7d535a
.PP
kusano 7d535a
Libtiff library home page:
kusano 7d535a
.BR http://www.remotesensing.org/libtiff/