Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_SetMarkers

Show in webframe

#include "l_bitmap.h"

L_LTFIL_API L_INT L_SetMarkers(hMarkers, uFlags)

L_VOID* hMarkers;

/* marker handle */

L_UINT uFlags;

/* flags that determine function behavior */

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

Parameter

Description

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.

uFlags

Reserved for future use. Pass 0.

Returns

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

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_CreateMarkers, L_LoadMarkers, L_SaveBitmap, L_SaveBitmapBuffer, L_SaveBitmapList, L_SaveBitmapMemory, L_SaveBitmapWithLayers, L_SaveFile, L_SaveFileBuffer, L_SaveFileMemory, L_SaveFileOffset, L_SaveFileTile

Topics:

Raster Image Functions: Markers

 

Working with Markers

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.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


 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;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.