LFile::EnumTags

Summary

Enumerates all the tags in a file. Currently, only TIFF and Exif files contain tags.

Syntax

#include "ltwrappr.h"

L_INT LFile::EnumTags(uFlags, pLoadOptions)

Parameters

L_UINT uFlags

Flags parameter. Reserved for future use. Pass 0.

pLOADFILEOPTION pLoadOptions

Pointer to optional extended load options. Pass NULL to use the default load options.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

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.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

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 Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.