Sets the metadata markers to be used in the current thread.
#include "l_bitmap.h"
L_LTFIL_API L_INT L_SetMarkers(hMarkers, uFlags)
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.
Reserved for future use. Pass 0.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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.
Win32, x64, Linux.
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("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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document