L_WriteFileMetaData

Summary

Writes metadata of the specified type to the specified file.

Syntax

#include "l_bitmap.h"

L_LTFIL_API L_INT L_WriteFileMetaData(pFile, uFlags, pSaveFileOption)

Parameters

L_TCHAR * pFile

Character string that contains the name of the file in which to write the metadata.

L_UINT uFlags

Flags that indicate the type of metadata to write. Possible values are:

Value Meaning
METADATA_COMMENTS [0x0001] Write comments.
METADATA_TAGS [0x0002] Write tags.
METADATA_MARKERS [0x0004] Write markers.
METADATA_GEOKEYS [0x0008] Write GeoKeys.
METADATA_ALL [0xFFFF] Write all metadata (tags, comments and markers).

These values can be combined using OR ( | ) or +.

pSAVEFILEOPTION pSaveFileOption

Pointer to optional extended save options. Pass NULL to use the default save options. pSaveOptions->PageNumber indicates the page on which to write the metadata.

Returns

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

Comments

L_WriteFileMetaData can be used to update an existing file pFile with comments, tags and/or markers. The file referenced by pFile must be JPEG, Exif JPEG, TIFF or Exif TIFF.

Note: For TIFF and Exif TIFF files, this function writes only marker data from an APP1 marker.

Before calling this function, the user should set:

When you add or remove comments or tags, the comments and tags array at the end of the TIFF/Exif image file is re-written. When you modify existing comments or tags, the new value is added to the file and the IFD is modified as necessary. In all of these cases, there is no image recompression.

Some restrictions apply to this function if you use an IFD to indicate to which page to write the metadata. See the Loading and Saving Large TIFF/BigTIFF Files topic for more information.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example writes a proprietary tag and a comment at the same time.
The output file should exist and should be a valid Exif file.

L_INT WriteFileMetaDataExample(L_VOID) 
{ 
   L_INT nRet; 
   L_INT nVal = 1234; 
   L_TCHAR *pOutput = TEXT("UNICODE Comment written with L_WriteFileMetaData"); 
   nRet = L_SetTag(0x8001, TAG_LONG, 1, &nVal); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_SetComment(CMNT_SZDESC,(L_UCHAR *) pOutput , lstrlen(pOutput)+1*sizeof(L_TCHAR)); 
   if(nRet < SUCCESS) 
      return nRet; 
   nRet = L_WriteFileMetaData(MAKE_IMAGE_PATH(TEXT("test.tif")), METADATA_ALL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 

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

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.