TIFFSetField, TIFFVSetField − set the value(s) of a tag in a TIFF file open for writing
#include <tiffio.h>
int TIFFSetField(TIFF *tif, ttag_t tag, ...)
#include <stdarg.h>
int TIFFVSetField(TIFF *tif, ttag_t tag, va_list ap)
TIFFSetField sets the value of a field or pseudo-tag in the current directory associated with the open TIFF file tif. (A pseudo-tag is a parameter that is used to control the operation of the TIFF library but whose value is not read or written to the underlying file.) To set the value of a field the file must have been previously opened for writing with TIFFOpen(3TIFF); pseudo-tags can be set whether the file was opened for reading or writing. The field is identified by tag, one of the values defined in the include file tiff.h (see also the table below). The actual value is specified using a variable argument list, as prescribed by the stdarg(3) interface (or, on some machines, the varargs(3) interface.)
TIFFVSetField is functionally equivalent to TIFFSetField except that it takes a pointer to a variable argument list. TIFFVSetField is useful for writing routines that are layered on top of the functionality provided by TIFFSetField.
The tags understood by libtiff, the number of parameter values, and the expected types for the parameter values are shown below. The data types are: char* is null-terminated string and corresponds to the ASCII data type; uint16_t is an unsigned 16-bit value; uint32_t is an unsigned 32-bit value; uint16_t* is an array of unsigned 16-bit values. void* is an array of data values of unspecified type.
Consult the TIFF specification for information on the meaning of each tag.
Tag Name
Count
Types
Notes
TIFFTAG_ARTIST
1
char*
TIFFTAG_BADFAXLINES
uint32_t
TIFFTAG_BITSPERSAMPLE
uint16_t
†
TIFFTAG_CLEANFAXDATA
TIFFTAG_COLORMAP
3
uint16_t*
1<<BitsPerSample arrays
TIFFTAG_COMPRESSION
TIFFTAG_CONSECUTIVEBADFAXLINES
TIFFTAG_COPYRIGHT
TIFFTAG_DATETIME
TIFFTAG_DOCUMENTNAME
TIFFTAG_DOTRANGE
2
TIFFTAG_EXTRASAMPLES
uint16_t,uint16_t*
† count & types array
TIFFTAG_FAXFILLFUNC
TIFFFaxFillFunc
G3/G4 compression pseudo-tag
TIFFTAG_FAXMODE
int
† G3/G4 compression pseudo-tag
TIFFTAG_FILLORDER
TIFFTAG_GROUP3OPTIONS
TIFFTAG_GROUP4OPTIONS
TIFFTAG_HALFTONEHINTS
TIFFTAG_HOSTCOMPUTER
TIFFTAG_ICCPROFILE
uint32_t,void*
count, profile data
TIFFTAG_IMAGEDEPTH
TIFFTAG_IMAGEDESCRIPTION
TIFFTAG_IMAGELENGTH
TIFFTAG_IMAGEWIDTH
TIFFTAG_INKNAMES
uint16_t, char*
TIFFTAG_INKSET
TIFFTAG_JPEGCOLORMODE
† JPEG pseudo-tag
TIFFTAG_JPEGQUALITY
JPEG pseudo-tag
TIFFTAG_JPEGTABLES
uint32_t*,void*
† count & tables
TIFFTAG_JPEGTABLESMODE
TIFFTAG_MAKE
TIFFTAG_MATTEING
TIFFTAG_MAXSAMPLEVALUE
TIFFTAG_MINSAMPLEVALUE
TIFFTAG_MODEL
TIFFTAG_ORIENTATION
TIFFTAG_PAGENAME
TIFFTAG_PAGENUMBER
TIFFTAG_PHOTOMETRIC
TIFFTAG_PHOTOSHOP
?
count, data
TIFFTAG_PLANARCONFIG
TIFFTAG_PREDICTOR
TIFFTAG_PRIMARYCHROMATICITIES
float*
6-entry array
TIFFTAG_REFERENCEBLACKWHITE
† 6-entry array
TIFFTAG_RESOLUTIONUNIT
TIFFTAG_RICHTIFFIPTC
TIFFTAG_ROWSPERSTRIP
† must be > 0
TIFFTAG_SAMPLEFORMAT
TIFFTAG_SAMPLESPERPIXEL
† value must be <= 4
TIFFTAG_SMAXSAMPLEVALUE
double
TIFFTAG_SMINSAMPLEVALUE
TIFFTAG_SOFTWARE
TIFFTAG_STONITS
TIFFTAG_SUBFILETYPE
TIFFTAG_SUBIFD
uint16_t,uint32_t*
count & offsets array
TIFFTAG_TARGETPRINTER
TIFFTAG_THRESHHOLDING
TIFFTAG_TILEDEPTH
TIFFTAG_TILELENGTH
† must be a multiple of 8
TIFFTAG_TILEWIDTH
TIFFTAG_TRANSFERFUNCTION
1 or 3‡ uint16_t*
1<<BitsPerSample entry arrays
TIFFTAG_WHITEPOINT
2-entry array
TIFFTAG_XMLPACKET
TIFFTAG_XPOSITION
float
TIFFTAG_XRESOLUTION
TIFFTAG_YCBCRCOEFFICIENTS
† 3-entry array
TIFFTAG_YCBCRPOSITIONING
TIFFTAG_YCBCRSAMPLING
TIFFTAG_YPOSITION
TIFFTAG_YRESOLUTION
† Tag may not have its values changed once data is written. ‡ If SamplesPerPixel is one, then a single array is passed; otherwise three arrays should be passed. * The contents of this field are quite complex. See The ICC Profile Format Specification, Annex B.3 "Embedding ICC Profiles in TIFF Files" (available at http://www.color.org) for an explanation.
1 is returned if the operation was successful. Otherwise, 0 is returned if an error was detected.
All error messages are directed to the TIFFError(3TIFF) routine.
%s: Cannot modify tag "%s" while writing. Data has already been written to the file, so the specified tag’s value can not be changed. This restriction is applied to all tags that affect the format of written data.
%d: Bad value for "%s". An invalid value was supplied for the named tag.
TIFFOpen(3TIFF), TIFFGetField(3TIFF), TIFFSetDirectory(3TIFF), TIFFWriteDirectory(3TIFF), TIFFReadDirectory(3TIFF), libtiff(3TIFF)
Libtiff library home page: http://www.simplesystems.org/libtiff/