L_EnumFileTags

Summary

✎ NOTE

This function is deprecated, use L_EnumFileTags2 instead.

Enumerates all the TIFF tags in a file. See the Comments section below for a list of formats which support TIFF tags.

Syntax

#include "l_bitmap.h"

L_LTFIL_API L_INT L_EnumFileTags (pszFile, uFlags, pfnCallback, pUserData, pLoadOptions)

Parameters

L_TCHAR* pszFile

Character string containing the name of the file in which to enumerate the tags.

L_UINT uFlags

Reserved for future use. Pass 0.

ENUMTAGSCALLBACK pfnCallback

Callback function for enumerating each tag. Use the function pointer as the value of this parameter. L_EnumFileTags calls this callback function for each tag. The callback function must adhere to the function prototype described in the ENUMTAGSCALLBACK callback function.

L_VOID* pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs. To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.

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. You can use the L_TagsSupported function to determine whether a certain file format supports tags.

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 L_ReadFileTag.

Note that if ENUMTAGSCALLBACK returns a value other than SUCCESS, L_EnumFileTags will stop enumerating the tags and return the value returned by ENUMTAGSCALLBACK as its return value.

DO NOT use the L_DeleteTag function to delete tags from inside an ENUMTAGSCALLBACK callback function. To do this, use ENUMTAGSCALLBACK to add the tags to a list. Upon returning from L_EnumFileTags, delete all the tags from the list.

For general information about TIFF tags, refer to Implementing TIFF Comments and Tags.

If the format of the file is known, better performance can be achieved by enumerating the tags using the L_EnumFileTags2 function.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example will read all the user tags from page 1 of "file.tif".

L_INT EXT_CALLBACK EnumFileTagCallback(L_UINT16  uTag, 
                                       L_UINT16  uType, 
                                       L_UINT32  uCount, 
                                       L_VOID  * pUserData) 
{ 
   UNREFERENCED_PARAMETER(pUserData); 
   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 EnumFileTagsExample(HWND hWnd) 
{ 
   /* Enumerate the tags */ 
   UNREFERENCED_PARAMETER(hWnd); 
   return L_EnumFileTags(MAKE_IMAGE_PATH("OCR1.tif"), 0, EnumFileTagCallback, NULL, NULL); 
} 

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