L_SetMarkers

#include "l_bitmap.h"

L_LTFIL_API L_INT L_SetMarkers(hMarkers, uFlags)

Sets the metadata markers to be used in the current thread.

Parameters

L_VOID* hMarkers

Handle to a collection of metadata markers. This handle is created by either the L_LoadMarkers function or the L_CreateMarkers function. This handle can reference Exif and/or GPS comments, a small Exif stamp, a bigger wireless stamp, audio data and whatever else was in the original file.

The markers referenced by this handle will replace the markers previously set using L_SetMarkers.

Pass NULL to clear any markers previously set by L_SetMarkers.

L_UINT uFlags

Reserved for future use. Pass 0.

Returns

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

Comments

All save operations performed in this thread will use these markers until L_SetMarkers is called again.

A copy of these markers will be used, so you can delete hMarkers when L_SetMarkers returns.

Comments set with L_SetComment will take precedence over any comments contained in the markers.

Tags set with L_SetTag will take precedence over any user-defined tags contained in the markers.

If the L_SaveXXX function is instructed to save a stamp, the stamp will be regenerated from the bitmap and will override whatever Exif stamp is present in the markers.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example lets you modify a file and preserve all its metadata, comments and audio. Keep in mind this will not save any stamp. If you want to save a stamp, modify the L_SaveBitmap call and tell it to save a stamp. That will make L_SaveBitmap regenerate a new stamp so it matches the modified image.

L_INT SetMarkersExample(L_TCHAR * pszFile) 
{ 
   L_INT nRet; 
   HANDLE hMetadata; 
   BITMAPHANDLE Bitmap; 
 
   // load metadata info 
   nRet = L_LoadMarkers(pszFile, &hMetadata, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // load the bitmap 
   nRet = L_LoadBitmap(pszFile, &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_RGB, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // modify the bitmap. In this case, flip it 
   nRet = L_FlipBitmap(&Bitmap); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // set the metadata markers so they are used in the next save 
   nRet = L_SetMarkers(hMetadata, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // save the file  
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("FlippedFile.jpg")), &Bitmap, FILE_EXIF_JPEG, 0, 50, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // reset the markers so they are not used for the next save 
   nRet = L_SetMarkers(NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // free memory containing the metadata 
   nRet = L_FreeMarkers(hMetadata); 
   if(nRet != SUCCESS) 
      return nRet; 
   if(Bitmap.Flags.Allocated) 
      L_FreeBitmap(&Bitmap); 
   return SUCCESS; 
} 

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help