Enumerates all the tags in a file. Currently, only TIFF and Exif files contain tags.
#include "ltwrappr.h"
L_INT LFile::EnumTags(uFlags, pLoadOptions)
Flags parameter. Reserved for future use. Pass 0.
Pointer to optional extended load options. Pass NULL to use the default load options.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Initially, only TIFF files supported TIFF tags. But the Exif specification provided a mechanism for adding TIFF tags to JPEG files using the APP1 JPEG marker. Additionally, other formats are based on the TIFF specification (CALS, TIFX, KDC) or support Exif metadata (HEIF/HEIC, PNG), so they support TIFF tags as well. In other words, TIFF tags are supported in file formats other than TIFF.
For multipage TIFF files, you can enumerate the tags from a particular page. Specify the page number on which to enumerate the tags using the pLoadOptions structure. For more information, refer to the LOADFILEOPTION structure.
This function enumerates the standard TIFF tags and the user tags. Standard TIFF tags are less than 32767. User TIFF tags are usually between 32768 and 65535.
To read a tag value, call LFile::ReadTag.
Note that if LFile::EnumTagsCallBack returns a value other than SUCCESS, LFile::EnumTags will stop enumerating the tags and return the value returned by LFile::EnumTagsCallBack as its return value.
Do not attempt to use the LFile::DeleteTag function to delete tags from inside an LFile::EnumTagsCallback callback function. If you want to delete tags that you enumerate, use LFile::EnumTagsCallback to add the tags to a list. Upon returning from LFile::EnumTags, you can delete all the tags from the list.
Win32, x64.
This example will read all the user tags from page 1 of "clean.tif".
/*<struct>*/
#ifdef LFileChild
class LFileChild : public LFile
{
L_INT EnumGeoKeysCallBack(L_UINT16 uTag,L_UINT16 uType,L_UINT32 uCount, L_VOID *pData);
L_INT EnumTagsCallBack(L_UINT16 uTag, L_UINT16 uType, L_UINT32 uCount);
};
#endif // #ifdef LFileChild
/*</struct>*/
L_INT LFileChild::EnumTagsCallBack(L_UINT16 uTag, L_UINT16 uType, L_UINT32 uCount)
{
L_TCHAR s[100];
wsprintf(s, TEXT("Tag = %d, Type = %d, Count = %d"), uTag, uType, uCount);
MessageBox(NULL, s, TEXT("EnumFileTagCallback"), MB_OK);
return SUCCESS;
}
L_INT LFile__EnumTagsExample()
{
L_INT nRet;
LFileChild FileChild;
FileChild.EnableCallBack(TRUE) ;
FileChild.SetFileName(MAKE_IMAGE_PATH(TEXT("clean.tif"))) ;
/* Enumerate the tags */
nRet = FileChild.EnumTags(0, NULL);
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document