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