TIFFSETFIELD(3tiff)
πΈ NAME πΈ
TIFFSetField β set the value(s) of a tag in a TIFF file open for writing π
so yeah bestie, this is TIFFSETFIELD(3tiff) from the LibTIFF manual, and it's literally the "how do I put a value on a tag" page. iconic behavior.
β¨ SYNOPSIS β¨
#include <tiffio.h>
#include <stdarg.h>"
int TIFFSetField(TIFF *tif, uint32_t tag, ...)
int TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
int TIFFUnsetField(TIFF *tif, uint32_t tag)
(and yes, that stray " after stdarg.h is really in there, we don't make the rules π)
π DESCRIPTION π
okay so TIFFSetField() sets the value of a field or a pseudo-tag in the current directory associated with the open TIFF file tif. quick vibe check on pseudo-tags: a pseudo-tag is a parameter that controls how the TIFF library operates, but its value is not read from or written to the underlying file. so it's like, a mood, not a record. π
to set the value of a field, the file has to have already been opened for writing with TIFFOpen(). that's the whole deal β no write-open, no setting fields. pseudo-tags though? those you can set whether the file was opened for reading or writing. flexible queens. π
the field itself is identified by tag, which is one of the values defined in the include file tiff.h (there's also a table further down, keep scrolling). the actual value gets specified with a variable argument list, exactly as the stdarg.h interface prescribes. very ... of it. β¨
TIFFVSetField() is functionally equivalent to TIFFSetField() β same energy, same results β except it takes a pointer to a variable argument list. it's the one you want when you're writing routines layered on top of the functionality that TIFFSetField() gives you. π«Ά
TIFFUnsetField() clears the contents of the field in the internal structure. and if it's a custom field? it gets removed from the list of known tags. gone. deleted. no cap. π
the tags libtiff understands, how many parameter values each one takes, and the expected types for those parameter values, are all shown below. the data types go like this:
π TAG DATA TYPES π
char*β a null-terminated string corresponding to the ASCII data type πΈuint16_tβ an unsigned 16-bit valueuint32_tβ an unsigned 32-bit value;uint16_t*β an array of unsigned 16-bit values. (yes, an array, plural energy π¦)void*β an array of data values of unspecified type. mysterious. main character. β¨
π consult the TIFF specification for information on the meaning of each tag. like, fr fr β this page tells you how to set them, the spec tells you what they actually mean.
okay that's the setup out of the way, and the big tag table is coming right up next, so don't go anywhere bestie π
π·οΈ TAG PROPERTIES π·οΈ
ok so this is the big one bestie. every tag you can hand to TIFFSetField lives in this table, and each row tells you three things: the tag's name, its Count (how many values it wants), and the Types it accepts. there's also a little Notes column for the β¨extra loreβ¨ β like when a tag is a pseudo-tag, or when the value count is something you have to compute yourself.
some of these rows have a little dagger (β ) sitting in the Notes column, exactly like in the original table. it's there, it's mysterious, it's giving cryptic. π
TIFFTAG_ARTISTβ Count1, Typeschar*TIFFTAG_BADFAXLINESβ Count1, Typesuint32_tTIFFTAG_BITSPERSAMPLEβ Count1, Typesuint16_t, NotesβTIFFTAG_CLEANFAXDATAβ Count1, Typesuint16_tTIFFTAG_COLORMAPβ Count3, Typesuint16_t*, Notes1 << BitsPerSamplearraysTIFFTAG_COMPRESSIONβ Count1, Typesuint16_t, NotesβTIFFTAG_CONSECUTIVEBADFAXLINESβ Count1, Typesuint32_tTIFFTAG_COPYRIGHTβ Count1, Typeschar*TIFFTAG_DATETIMEβ Count1, Typeschar*TIFFTAG_DOCUMENTNAMEβ Count1, Typeschar*TIFFTAG_DOTRANGEβ Count2, Typesuint16_tTIFFTAG_EXTRASAMPLESβ Count2, Typesuint16_t,uint16_t*, Notesβcount, types arrayTIFFTAG_FAXFILLFUNCβ Count1, TypesTIFFFaxFillFunc, Notes G3/G4 compression pseudo-tagTIFFTAG_FAXMODEβ Count1, Typesint, NotesβG3/G4 compression pseudo-tagTIFFTAG_FILLORDERβ Count1, Typesuint16_t, NotesβTIFFTAG_GROUP3OPTIONSβ Count1, Typesuint32_t, NotesβTIFFTAG_GROUP4OPTIONSβ Count1, Typesuint32_t, NotesβTIFFTAG_HALFTONEHINTSβ Count2, Typesuint16_tTIFFTAG_HOSTCOMPUTERβ Count1, Typeschar*TIFFTAG_ICCPROFILEβ Count2, Typesuint32_t,void*, Notes count, profile data*TIFFTAG_IMAGEDEPTHβ Count1, Typesuint32_t, NotesβTIFFTAG_IMAGEDESCRIPTIONβ Count1, Typeschar*TIFFTAG_IMAGELENGTHβ Count1, Typesuint32_tTIFFTAG_IMAGEWIDTHβ Count1, Typesuint32_t, NotesβTIFFTAG_INKNAMESβ Count2, Typesuint16_t,char*TIFFTAG_INKSETβ Count1, Typesuint16_t, NotesβTIFFTAG_JPEGCOLORMODEβ Count1, Typesint, NotesβJPEG pseudo-tagTIFFTAG_JPEGQUALITYβ Count1, Typesint, Notes JPEG pseudo-tagTIFFTAG_JPEGTABLESβ Count2, Typesuint32_t*,void*, Notesβcount, tablesTIFFTAG_JPEGTABLESMODEβ Count1, Typesint, NotesβJPEG pseudo-tagTIFFTAG_MAKEβ Count1, Typeschar*
and bestieβ¦ the list does NOT stop there. there's more where that came from, so hold my hand and let's keep scrolling π«Ά
TIFFTAG_MATTEINGβ count1, typeuint16_t, and yes bestie it's got the β marker on it πTIFFTAG_MAXSAMPLEVALUEβ count1, auint16_t, no extra dramaTIFFTAG_MINSAMPLEVALUEβ count1,uint16_t, also just vibingTIFFTAG_MODELβ count1, typechar*(it's a little string, she's a text girlie)TIFFTAG_ORIENTATIONβ count1,uint16_t, tells the file which way is upTIFFTAG_PAGENAMEβ count1,char*, name of the page, iconicTIFFTAG_PAGENUMBERβ count2,uint16_tβ two of them, it's giving duo energyTIFFTAG_PHOTOMETRICβ count1,uint16_tTIFFTAG_PHOTOSHOPβ count?(mysterious π), typesuint32_t, void*, notes say count, dataTIFFTAG_PLANARCONFIGβ count1,uint16_t, β marked, so tread carefullyTIFFTAG_PREDICTORβ count1,uint16_t, β on it tooTIFFTAG_PRIMARYCHROMATICITIESβ count1,float*, and it's a 6-entry array (six!! π)TIFFTAG_REFERENCEBLACKWHITEβ count1,float*, β and also a 6-entry arrayTIFFTAG_RESOLUTIONUNITβ count1,uint16_t, plain and unbotheredTIFFTAG_RICHTIFFIPTCβ count2, typesuint32_t, void*, notes: count, dataTIFFTAG_ROWSPERSTRIPβ count1,uint32_t, β and it must be > 0 β no zero, no negative, do not test her π«TIFFTAG_SAMPLEFORMATβ count1,uint16_t, β marker presentTIFFTAG_SAMPLESPERPIXELβ count1,uint16_t, β and heads up: the value must be β€ 4. That's the ceiling, bestie πTIFFTAG_SMAXSAMPLEVALUEβ count1, typedoubleTIFFTAG_SMINSAMPLEVALUEβ count1, also adoubleTIFFTAG_SOFTWAREβ count1,char*β the "what made this file" stringTIFFTAG_STONITSβ count1, adouble, β flaggedTIFFTAG_SUBFILETYPEβ count1,uint32_tTIFFTAG_SUBIFDβ count2, typesuint16_t, uint64_t*, notes: count, offsets arrayTIFFTAG_TARGETPRINTERβ count1,char*TIFFTAG_THRESHHOLDINGβ count1,uint16_t(yes the spelling isTHRESHHOLDING, keep it exactly, no correcting her π)TIFFTAG_TILEDEPTHβ count1,uint32_t, β markerTIFFTAG_TILELENGTHβ count1,uint32_t, β and it must be a multiple of 8 β that is non-negotiable fr frTIFFTAG_TILEWIDTHβ count1,uint32_t, β and also must be a multiple of 8, same rule, same energyTIFFTAG_TRANSFERFUNCTIONβ count is1 or 3β‘ (yep, one or three, depends), typeuint16_t*, and the arrays are1 << BitsPerSampleentries bigTIFFTAG_WHITEPOINTβ count1,float*, a 2-entry arrayTIFFTAG_XMLPACKETβ count2, typesuint32_t, void*, notes: count, dataTIFFTAG_XPOSITIONβ count1, typefloatTIFFTAG_XRESOLUTIONβ count1, typefloatTIFFTAG_YCBCRCOEFFICIENTSβ count1, typefloat*, and it's got a β on it: it's a3-entry arrayTIFFTAG_YCBCRPOSITIONINGβ count1, typeuint16_t, βTIFFTAG_YCBCRSAMPLINGβ count2, typeuint16_t, βTIFFTAG_YPOSITIONβ count1, typefloatTIFFTAG_YRESOLUTIONβ count1, typefloat
ποΈ the footnote key, iykyk
ββ this tag may not have its values changed once data is written. it's locked in. no takebacks, no edits, periodt πβ‘β ifSamplesPerPixelis one, then a single array is passed; otherwise three arrays should be passed. one array or three, choose wisely bestie π*β the contents of this field are quite complex. See "The ICC Profile Format Specification", Annex B.3 "Embedding ICC Profiles in TIFF Files" (available athttp://www.color.org) for an explanation.
β¨ RETURN VALUES β¨
1 is returned if the operation was successful. slay π
Otherwise, 0 is returned if an error was detected. not slay π
π¨ DIAGNOSTICS π¨
All error messages are directed to the TIFFErrorExtR() routine. every single one. it's giving customer service hotline fr fr π
%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. so like, once you've committed, you've committed π%d: Bad value for "%s":β an invalid value was supplied for the named tag. she said no β
π SEE ALSO π
TIFFOpen(3tiff)TIFFGetField(3tiff)TIFFSetDirectory(3tiff)TIFFWriteDirectory(3tiff)TIFFReadDirectory(3tiff)libtiff(3tiff)
π AUTHOR π
LibTIFF contributors β the collective, the group chat, the squad π«Ά
π COPYRIGHT π
1988-2025, LibTIFF contributors
okay bestie that's the whole page, we did it, we ate and left no crumbs πβ¨ this was TIFFSETFIELD(3tiff), version 4.7, dated Jun 27, 2026 β go set some fields, you've got this π
π
π¦ where this page comes from
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-3.fc43 Β· libtiff
- fedora 43: libtiff-devel 4.7.2-3.fc43 Β· libtiff
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-3.fc44 Β· libtiff
- fedora 44: libtiff-devel 4.7.2-3.fc44 Β· libtiff
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms