Deletes a tag from a file, if the file supports tags (TIFF or Exif).
#include "ltwrappr.h"
L_INT LFile::DeleteTag(nPage, uTag, uFlags, pSaveOptions)
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.
The ID of the tag in the TIFF file. The tag IDs are between 0 and 65535.
Reserved for future use. Pass 0.
Pointer to optional extended save options. Pass NULL to use the default save options.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
ERROR_TAG_MISSING | The requested tag is missing. |
< 1 | An error occurred. Refer to Return Codes. |
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
The LFCMP filter is used to delete the tag from all the TIFF and Exif files.
Do not attempt to use this function to delete tags from inside an LFile::EnumTagsCallBack callback function. If you want to delete tags that you enumerate, use LFile::EnumTagsCallBack to add the tags to a list. Upon returning from LFile::EnumTags, you can delete all the tags from the list.
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.
Win32, x64.
The following example will delete the tag 0x8001 from page 1 of a TIFF file.
#define TGPAGENUMBER 266
L_INT LFile__DeleteTagExample()
{
LFile File;
LOADFILEOPTION LoadFileOption;
L_INT nRet = 0;
File.SetFileName(MAKE_IMAGE_PATH(TEXT("OCR1.tif")));
File.GetDefaultLoadFileOption(&LoadFileOption, sizeof(LoadFileOption));
LoadFileOption.PageNumber = 1;
nRet = File.ReadTag(TGPAGENUMBER, NULL, NULL, NULL, &LoadFileOption) ;
if (nRet != SUCCESS)
{
nRet = File.DeleteTag(1, TGPAGENUMBER, 0, NULL);
if(nRet != SUCCESS)
return nRet;
}
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