LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
Typedefs | Functions
Tag access

Get, set, unset, and default values through tag-specific arguments. More...

Collaboration diagram for Tag access:

Typedefs

typedef int(* TIFFVSetMethod) (TIFF *tif, uint32_t tag, va_list ap)
 Implement a handle's variadic tag setter.
 
typedef int(* TIFFVGetMethod) (TIFF *tif, uint32_t tag, va_list ap)
 Implement a handle's variadic tag getter.
 
typedef void(* TIFFPrintMethod) (TIFF *tif, FILE *fd, long flags)
 Append extension-specific directory information to a stream.
 

Functions

int TIFFGetField (TIFF *tif, uint32_t tag,...)
 Query a present tag in the current directory.
 
int TIFFVGetField (TIFF *tif, uint32_t tag, va_list ap)
 Query a present tag in the current directory.
 
int TIFFGetFieldDefaulted (TIFF *tif, uint32_t tag,...)
 Query a present tag or a supported default.
 
int TIFFVGetFieldDefaulted (TIFF *tif, uint32_t tag, va_list ap)
 Query a present tag or a supported default.
 
int TIFFSetField (TIFF *tif, uint32_t tag,...)
 Set a tag value in the current in-memory directory.
 
int TIFFVSetField (TIFF *tif, uint32_t tag, va_list ap)
 Set a tag value in the current in-memory directory.
 
int TIFFUnsetField (TIFF *tif, uint32_t tag)
 Clear tag presence or remove a stored custom value.
 

Detailed Description

Get, set, unset, and default values through tag-specific arguments.

See Tag arguments before constructing a variadic call.

Typedef Documentation

◆ TIFFPrintMethod

typedef void(* TIFFPrintMethod) (TIFF *tif, FILE *fd, long flags)

Append extension-specific directory information to a stream.

Invoked synchronously by TIFFPrintDirectory() after core and custom values, and before optional strip/tile rows. Borrowed arguments are valid only for this call; do not close/free them. Follow TIFFPRINT_* controls, delegate saved parent printers where needed, and avoid recursive directory printing. The original flags are forwarded unchanged, including bits unused by the core formatter. Callback code must remain live while installed or in flight. The caller performs no exception handling or aggregate output-status check. Stream errors cannot be returned by this interface; report failures through diagnostics if required.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in,out]fdNon-NULL writable caller-owned stdio stream.
[in]flagsTIFFPRINT_* bit mask.

Definition at line 1561 of file tiffio.h.

◆ TIFFVGetMethod

typedef int(* TIFFVGetMethod) (TIFF *tif, uint32_t tag, va_list ap)

Implement a handle's variadic tag getter.

Invoked synchronously for registered, set tags or pseudo-tags. Use Tag arguments to fill caller-owned outputs; returned arrays remain borrowed. Delegate unhandled tags to the saved parent method without recursing through TIFFGetField(). Queries may allocate/cache data or do I/O. On failure outputs need not be unchanged; the caller must not use them. No handle/list ownership transfers.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagTag number in the current namespace.
[in,out]apBorrowed output-argument list; traversal and pointed-to outputs may change. Use va_copy() for independent traversal.
Returns
One when values were supplied, zero if unavailable or failed.

Definition at line 1540 of file tiffio.h.

◆ TIFFVSetMethod

typedef int(* TIFFVSetMethod) (TIFF *tif, uint32_t tag, va_list ap)

Implement a handle's variadic tag setter.

Invoked synchronously after TIFFVSetField() validates registration and mutability. Apply the tag-specific Tag arguments contract, copy borrowed values when storing them, and manage dirty/field bits and codec state. Save/delegate to the parent method for unhandled tags; calling TIFFSetField() on the same tag would recurse. The callback owns no input list or handle. Diagnostics and partial failure state follow the implementation.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagRegistered tag number.
[in,out]apBorrowed list of promoted values/array pointers; may be traversed. Use va_copy() for an independent traversal.
Returns
One on success, zero on rejection/failure; no rollback is implied.

Definition at line 1521 of file tiffio.h.

Function Documentation

◆ TIFFGetField()

int TIFFGetField ( TIFF *  tif,
uint32_t  tag,
  ... 
)
extern

Query a present tag in the current directory.

See Tag arguments for exact pointer types, counts, exceptions, and lifetimes. Values are read from the current in-memory directory, not reread wholesale from disk. Registered pseudo-tags bypass the presence- bit test and may have codec effects. Array/string results are borrowed and must not be freed or modified; replacement, unsetting, directory change, codec cleanup, or handle cleanup can invalidate them. Deferred strip/tile arrays may allocate and perform I/O. Missing fields normally return zero silently; codec, I/O, and allocation failures can dispatch diagnostics. Outputs are usable only on success, and failure need not preserve them. No errno contract is provided.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagTag number in the current directory namespace.
[out]...Tag-specific non-NULL output pointers; see Tag arguments. Caller owns the output slots.
Returns
One if supplied, zero if absent, unsupported, or failed; outputs are valid only on success.

Definition at line 2099 of file tif_dir.c.

References TIFFVGetField().

Referenced by gtTileContig(), gtTileSeparate(), isCCITTCompression(), JPEGSetupEncode(), TIFFPrintDirectory(), TIFFRGBAImageBegin(), TIFFRGBAImageOK(), and TIFFWriteDirectorySec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TIFFGetFieldDefaulted()

int TIFFGetFieldDefaulted ( TIFF *  tif,
uint32_t  tag,
  ... 
)
extern

Query a present tag or a supported default.

See Tag arguments for exact pointer types, counts, exceptions, and lifetimes. Values are read from the current in-memory directory, not reread wholesale from disk. Registered pseudo-tags bypass the presence- bit test and may have codec effects. Array/string results are borrowed and must not be freed or modified; replacement, unsetting, directory change, codec cleanup, or handle cleanup can invalidate them. Deferred strip/tile arrays may allocate and perform I/O. Missing fields normally return zero silently; codec, I/O, and allocation failures can dispatch diagnostics. Outputs are usable only on success, and failure need not preserve them. No errno contract is provided. If ordinary lookup fails, selected core defaults are supplied. TransferFunction and ReferenceBlackWhite may be allocated/cached without setting tag presence; unsupported defaults still return zero. Static default arrays also remain borrowed. Failed custom getters must not consume ap before returning zero if this fallback is to reuse it safely.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagTag number in the current directory namespace.
[out]...Tag-specific non-NULL output pointers; see Tag arguments. Caller owns the output slots.
Returns
One if supplied, zero if absent, unsupported, or failed; outputs are valid only on success.

Definition at line 591 of file tif_aux.c.

References TIFFVGetFieldDefaulted().

Referenced by _TIFFStrileSize64(), gtStripContig(), gtStripSeparate(), gtTileContig(), initCIELabConversion(), initYCbCrConversion(), PickContigCase(), PickSeparateCase(), TIFFReadRGBAStripExt(), TIFFReadRGBATileExt(), TIFFRGBAImageBegin(), TIFFRGBAImageOK(), TIFFScanlineSize64(), TIFFTileRowSize64(), and TIFFWriteDirectorySec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TIFFSetField()

int TIFFSetField ( TIFF *  tif,
uint32_t  tag,
  ... 
)
extern

Set a tag value in the current in-memory directory.

See Tag arguments for exact promoted values, counts, array lengths, and exceptions. Changes update memory and dirty/field bits; file- directory persistence requires a later write/flush. Unknown tags or disallowed changes after writing begins are diagnosed and rejected (ImageLength is a special exception). Codec selection may clean up and reinitialise codec state. Core setters copy arrays/strings without taking ownership, but ExtraSamples may repair a caller element in place. Input storage must not alias replaced owned storage. Failure can discard old values, alter codec/related tags, or leave a partial custom entry; there is no rollback. Some void array-copy helpers lose data on allocation failure without changing the setter's success result. Diagnostics and errno alone do not establish success.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagRegistered tag or pseudo-tag number.
[in,out]...Promoted tag-specific values and borrowed buffers; ExtraSamples may be repaired in place. See Tag arguments.
Returns
One when accepted, zero on rejection or detected failure; acceptance is not proof that every array allocation succeeded.

Definition at line 1627 of file tif_dir.c.

References TIFFVSetField().

Referenced by allocChoppedUpStripArrays(), JPEGSetupEncode(), LogLuvVSetField(), PixarLogVSetField(), TIFFDefaultDirectory(), TIFFFetchNormalTag(), TIFFFetchSubjectDistance(), TIFFInitLERC(), TIFFInitOJPEG(), TIFFReadDirectory(), and TIFFRGBAImageBegin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TIFFUnsetField()

int TIFFUnsetField ( TIFF *  tif,
uint32_t  tag 
)
extern

Clear tag presence or remove a stored custom value.

A non-custom tag only has its field bit cleared: stored scalar/array values and codec configuration are not reset, and a shared bit can hide multiple tags. A custom entry frees its owned value and compacts the value list without unregistering its descriptor. Marks the directory dirty even when a known custom value was absent. Does not enforce setter mutability rules or persist changes. Unknown-tag warnings follow TIFFFieldWithTag(). No rollback or general resource-reset operation is provided.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagTag number whose descriptor is registered.
Returns
One for a known descriptor even if no value was present; zero for an unknown tag.

Definition at line 1641 of file tif_dir.c.

References _TIFFfreeExt(), _TIFFField::field_bit, FIELD_CUSTOM, _TIFFField::field_tag, TIFFTagValue::info, TIFFDirectory::td_customValueCount, TIFFDirectory::td_customValues, tiff::tif_dir, tiff::tif_flags, TIFF_DIRTYDIRECT, TIFFClrFieldBit, TIFFFieldWithTag(), and TIFFTagValue::value.

Here is the call graph for this function:

◆ TIFFVGetField()

int TIFFVGetField ( TIFF *  tif,
uint32_t  tag,
va_list  ap 
)
extern

Query a present tag in the current directory.

See Tag arguments for exact pointer types, counts, exceptions, and lifetimes. Values are read from the current in-memory directory, not reread wholesale from disk. Registered pseudo-tags bypass the presence- bit test and may have codec effects. Array/string results are borrowed and must not be freed or modified; replacement, unsetting, directory change, codec cleanup, or handle cleanup can invalidate them. Deferred strip/tile arrays may allocate and perform I/O. Missing fields normally return zero silently; codec, I/O, and allocation failures can dispatch diagnostics. Outputs are usable only on success, and failure need not preserve them. No errno contract is provided.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagTag number in the current directory namespace.
[in,out]apBorrowed tag-specific output list; pointed-to outputs and traversal can change. Do not reuse without va_copy().
Returns
One if supplied, zero if absent, unsupported, or failed; outputs are valid only on success.

Definition at line 2116 of file tif_dir.c.

References _TIFFField::field_bit, isPseudoTag, tiff::tif_tagmethods, TIFF_ANY, TIFFFieldSet, TIFFFindField(), and TIFFTagMethods::vgetfield.

Referenced by TIFFGetField(), and TIFFVGetFieldDefaulted().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TIFFVGetFieldDefaulted()

int TIFFVGetFieldDefaulted ( TIFF *  tif,
uint32_t  tag,
va_list  ap 
)
extern

Query a present tag or a supported default.

See Tag arguments for exact pointer types, counts, exceptions, and lifetimes. Values are read from the current in-memory directory, not reread wholesale from disk. Registered pseudo-tags bypass the presence- bit test and may have codec effects. Array/string results are borrowed and must not be freed or modified; replacement, unsetting, directory change, codec cleanup, or handle cleanup can invalidate them. Deferred strip/tile arrays may allocate and perform I/O. Missing fields normally return zero silently; codec, I/O, and allocation failures can dispatch diagnostics. Outputs are usable only on success, and failure need not preserve them. No errno contract is provided. If ordinary lookup fails, selected core defaults are supplied. TransferFunction and ReferenceBlackWhite may be allocated/cached without setting tag presence; unsupported defaults still return zero. Static default arrays also remain borrowed. Failed custom getters must not consume ap before returning zero if this fallback is to reuse it safely.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagTag number in the current directory namespace.
[in,out]apBorrowed tag-specific output list; pointed-to outputs and traversal can change. Do not reuse without va_copy().
Returns
One if supplied, zero if absent, unsupported, or failed; outputs are valid only on success.

Definition at line 422 of file tif_aux.c.

References D50_X0, D50_Y0, D50_Z0, EXTRASAMPLE_ASSOCALPHA, INKSET_CMYK, TIFFPredictorState::predictor, TIFFDirectory::td_bitspersample, TIFFDirectory::td_extrasamples, TIFFDirectory::td_fillorder, TIFFDirectory::td_imagedepth, TIFFDirectory::td_minsamplevalue, TIFFDirectory::td_orientation, TIFFDirectory::td_planarconfig, TIFFDirectory::td_refblackwhite, TIFFDirectory::td_resolutionunit, TIFFDirectory::td_rowsperstrip, TIFFDirectory::td_sampleformat, TIFFDirectory::td_sampleinfo, TIFFDirectory::td_samplesperpixel, TIFFDirectory::td_subfiletype, TIFFDirectory::td_threshholding, TIFFDirectory::td_tiledepth, TIFFDirectory::td_transferfunction, TIFFDirectory::td_ycbcrpositioning, TIFFDirectory::td_ycbcrsubsampling, tiff::tif_data, tiff::tif_dir, tiff::tif_name, TIFFDefaultRefBlackWhite(), TIFFDefaultTransferFunction(), TIFFErrorExtR(), TIFFTAG_BITSPERSAMPLE, TIFFTAG_DATATYPE, TIFFTAG_DOTRANGE, TIFFTAG_EXTRASAMPLES, TIFFTAG_FILLORDER, TIFFTAG_IMAGEDEPTH, TIFFTAG_INKSET, TIFFTAG_MATTEING, TIFFTAG_MAXSAMPLEVALUE, TIFFTAG_MINSAMPLEVALUE, TIFFTAG_NUMBEROFINKS, TIFFTAG_ORIENTATION, TIFFTAG_PLANARCONFIG, TIFFTAG_PREDICTOR, TIFFTAG_REFERENCEBLACKWHITE, TIFFTAG_RESOLUTIONUNIT, TIFFTAG_ROWSPERSTRIP, TIFFTAG_SAMPLEFORMAT, TIFFTAG_SAMPLESPERPIXEL, TIFFTAG_SUBFILETYPE, TIFFTAG_THRESHHOLDING, TIFFTAG_TILEDEPTH, TIFFTAG_TRANSFERFUNCTION, TIFFTAG_WHITEPOINT, TIFFTAG_YCBCRCOEFFICIENTS, TIFFTAG_YCBCRPOSITIONING, TIFFTAG_YCBCRSUBSAMPLING, and TIFFVGetField().

Referenced by TIFFGetFieldDefaulted().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TIFFVSetField()

int TIFFVSetField ( TIFF *  tif,
uint32_t  tag,
va_list  ap 
)
extern

Set a tag value in the current in-memory directory.

See Tag arguments for exact promoted values, counts, array lengths, and exceptions. Changes update memory and dirty/field bits; file- directory persistence requires a later write/flush. Unknown tags or disallowed changes after writing begins are diagnosed and rejected (ImageLength is a special exception). Codec selection may clean up and reinitialise codec state. Core setters copy arrays/strings without taking ownership, but ExtraSamples may repair a caller element in place. Input storage must not alias replaced owned storage. Failure can discard old values, alter codec/related tags, or leave a partial custom entry; there is no rollback. Some void array-copy helpers lose data on allocation failure without changing the setter's success result. Diagnostics and errno alone do not establish success.

Parameters
[in,out]tifNon-NULL live TIFF handle; accessed without internal locking.
[in]tagRegistered tag or pseudo-tag number.
[in,out]apBorrowed tag-specific value list; traversal and permitted mutable input data can change. Use va_copy() before reusing.
Returns
One when accepted, zero on rejection or detected failure; acceptance is not proof that every array allocation succeeded.

Definition at line 1686 of file tif_dir.c.

References OkToChangeTag(), tiff::tif_tagmethods, and TIFFTagMethods::vsetfield.

Referenced by TIFFSetField().

Here is the call graph for this function:
Here is the caller graph for this function: