L_LoadMarkers

#include "l_bitmap.h"

L_LTFIL_API L_INT L_LoadMarkers(pszFilename, phMarkers, uFlags)

L_TCHAR * pszFilename;

file name

L_VOID** phMarkers;

pointer to the marker handle

L_UINT uFlags;

flags that determine function behavior

Loads metadata markers (COM and APPn) into a handle.

Parameter

Description

pszFilename

Character string that contains the name of the file from which to load the collection of metadata markers.

phMarkers

Pointer to a variable to be updated with a handle to the collection of metadata markers. This handle is allocated by this function.

uFlags

Reserved for future use. Pass 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The handle referenced by the phMarkers parameter is allocated by this function. This handle can then be used to save the metadata information. For Exif files, this metadata handle will contain ALL the Exif and GPS comments, stored in APP1. It will also contain the audio information stored in APP2.

The markers can also be retrieved by calling L_TransformFile. Each retrieved marker is passed to the TRANSFORMFILECALLBACK function. There is one important difference between the markers passed to TRANSFORMFILECALLBACK and those loaded with L_LoadMarkers:

TRANSFORMFILECALLBACK receives ALL the markers (metadata and image-related markers).

L_LoadMarkers loads only the metadata markers.

When the marker collection handle is no longer needed, use the L_FreeMarkers function to free it.

To save the collection of metadata markers referenced by the handle in phMarkers to a file, pass this handle to the L_SetMarkers function.

IMPORTANT NOTE:

The comments set with L_SetComment will OVERRIDE any comments contained in the metadata markers. For example, if the original file had an author of "Steve" and you call

L_SetComment(CMNT_SZAUTHOR, TEXT("John"), 5);

the next time you save a file, the author will be John (not Steve). However, all the comments that have not been set will be taken from the metadata handle.

Required DLLs and Libraries

LTFIL

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_FreeMarkers, L_SetMarkers, L_WriteFileMetadata, L_TransformFile, TRANSFORMFILECALLBACK, L_EnumMarkers, L_InsertMarker, L_GetMarkerCount, L_GetMarker, L_MarkersSupported

Topics:

Raster Image Functions: Markers

 

Working with Markers

Example

L_INT LoadMarkersExample(HWND      hWnd, 
                                        L_TCHAR * pszSrc, 
                                        L_TCHAR * pszDest) 
{ 
   HANDLE hMarkers; 
   L_INT nRet; 
 
   FILEINFO info; 
   memset(&info, 0, sizeof (FILEINFO)); 
   info.uStructSize = sizeof(FILEINFO); 
 
   nRet = L_FileInfo(pszSrc, &info, sizeof(FILEINFO), 0, NULL); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   if (!L_MarkersSupported(info.Format)) 
      return ERROR_FEATURE_NOT_SUPPORTED; 
 
   nRet = L_LoadMarkers(pszSrc, &hMarkers, 0); 
   if(nRet != SUCCESS) 
   { 
      MessageBox(hWnd, TEXT("Error loading markers"), TEXT("FAILURE"), MB_OK); 
      return nRet; 
   } 
 
   L_SetMarkers(hMarkers, 0); 
   nRet = L_FreeMarkers(hMarkers); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return L_WriteFileMetaData(pszDest, METADATA_ALL, NULL); 
} 
Help Version 20.0.2018.7.30
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help