L_DeleteTag

#include "l_bitmap.h"

L_LTFIL_API L_INT L_DeleteTag(pszFile, nPage, uTag, uFlags, pSaveOptions)

L_TCHAR* pszFile;

file name

L_INT nPage;

page number

L_UINT uTag;

the ID of the tag that should be deleted

L_UINT uFlags;

reserved for future use

pSAVEFILEOPTION pSaveOptions;

pointer to optional extended save options

Deletes a tag from a file, if the file supports tags (TIFF or Exif).

Parameter

Description

pszFile

Character string containing the name of the file from which to delete the tag.

nPage

Number of the page from which the tag will be deleted. Use -1 to delete the tag from the last page. Use 1 to delete the tag from the first page.

uTag

The ID of the tag in the TIFF file. The tag IDs are between 0 and 65535.

uFlags

Reserved for future use. Pass 0.

pSaveOptions

Pointer to optional extended save options. Pass NULL to use the default save options.

Returns

SUCCESS

The function was successful.

ERROR_TAG_MISSING

The requested tag is missing.

< 1

An error occurred. Refer to Return Codes.

Comments

Note that if you pass a SAVEFILEOPTION, the PageNumber member of that structure will be ignored. The page number is indicated through the nPage parameter of this function.

If you want to delete the tag from a particular IFD in the file, set ESO_USEIFD in the SAVEFILEOPTIONS.Flags parameter and set SAVEFILEOPTIONS.IFD to the IFD in question. This function will delete tags only from the main IFDs that make up an image. Some TIFF tags are themselves SubIFDs. You can delete tags from such SubIFDs by using the SAVEFILEOPTION and specifying the IFD as above.

Notes:

1.

The LFCMP filter is used to delete the tag from all the TIFF and Exif files.

2.

Do not attempt to use this function to delete tags from inside an ENUMTAGSCALLBACK callback function. If you want to delete tags that you enumerate, use ENUMTAGSCALLBACK to add the tags to a list. Upon returning from L_EnumFileTags, you can delete all the tags from the list.

3.

You should be careful when you delete non-custom tags (tags below 32768). If you delete the wrong tag, you might corrupt the TIF file.

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.

Required DLLs and Libraries

LTFIL

LFCMP

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_ReadFileTag, L_WriteFileTag, L_SetTag, L_GetTag, L_EnumFileTags, L_ReadFileTags

Topics:

Implementing TIFF Comments and Tags

Example

#define FILENAME MAKE_IMAGE_PATH(TEXT("OCR1.tif")) 
#define TGPAGENUMBER 266 
 
L_INT DeleteTagExample(HWND hWnd) 
{ 
   L_INT nRet; 
   LOADFILEOPTION LoadFileOption; 
 
   nRet = L_GetDefaultLoadFileOption(&LoadFileOption, sizeof(LoadFileOption)); 
   if(nRet != SUCCESS) 
      return nRet; 
   LoadFileOption.PageNumber = -1; 
 
   if(L_ReadFileTag(FILENAME, TGPAGENUMBER, NULL, NULL, NULL, &LoadFileOption) > 0) 
   { 
      nRet = L_DeleteTag(FILENAME, -1, TGPAGENUMBER, 0, NULL); 
      if(nRet != SUCCESS) 
      { 
         MessageBox(hWnd, TEXT("L_DeleteTag failed!"), TEXT("Error"), MB_OK); 
         return nRet; 
      } 
      else 
         MessageBox(hWnd, TEXT("L_DeleteTag SUCCEEDED!"), TEXT("SUCCESS"), MB_OK); 
   } 
   else 
      MessageBox(hWnd, TEXT("Page 2 does not have a PAGENUMBER tag!"), TEXT("Error"), MB_OK); 
   return SUCCESS; 
} 

Help Version 20.0.2018.1.19
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help