L_EnumFileTags

#include "l_bitmap.h"

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

L_TCHAR* pszFile;

character string containing the input file name

L_UINT uFlags;

reserved for future use. Pass 0.

ENUMTAGSCALLBACK pfnCallback;

callback function

L_VOID* pUserData;

user data parameter that will be passed to pfnCallback

pLOADFILEOPTION pLoadOptions;

pointer to optional extended load options

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

Parameter

Description

pszFile

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

uFlags

Flags parameter. Reserved for future use. Pass 0.

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.

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.

pLoadOptions

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

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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 attempt to use the L_DeleteTag function to delete tags from inside an ENUMTAGSCALLBACK callback function. If you want to delete tags that you enumerate, use ENUMTAGSCALLBACK to add the tags to a list. Upon returning from L_EnumFileTags, you can delete all the tags from the list.

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

Required DLLs and Libraries

LTFIL

LFCMP

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64, Linux.

See Also

Functions:

L_ReadFileTag, L_WriteFileTag, L_SetTag, L_GetTag, ENUMTAGSCALLBACK, L_DeleteTag, L_ReadFileTags

Topics:

Implementing TIFF Comments and Tags.

Example

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

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
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(TEXT("OCR1.tif")), 0, EnumFileTagCallback, NULL, NULL); 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help