←Select platform

EnumTags(string,int) Method

Enumerates all the tags in a file.
public void EnumTags( 
   string fileName, 
   int pageNumber 
- (BOOL)enumerateTagsInFile:(NSString *)file  
                   callback:(void (^)(LTCodecsEnumTagsEventArgs *tagInfo))handler  
                      error:(NSError **)error 
void EnumTags(  
   String^ fileName, 
   int pageNumber 


A String containing the input file name.

1-based index of the page from which to enumerate the tags.


This method will fire the TagFound event for each tag found in the file.

Currently, only TIFF and Exif files contain tags.

For multipage TIFF files, you can enumerate the tags from a particular page. Specify the page number which has the tags to be enumerated.

This method enumerates the standard TIFF tags and the user tags. Standard TIFF tags are less than 32767. User TIFF tags are usually between 32768 and 65535.

To enumerate the tags stored in a stream, use EnumTags.

To read a tag value, use ReadTag and to read all the tags in a file, use ReadTags.

For general information about TIFF tags, refer to Implementing TIFF Comments and Tags.

Do not attempt to use DeleteTag to delete tags from inside the TagFound event. If you want to delete tags that you enumerate, use this event to add the tags to a list. Upon returning from EnumTags, you can delete all the tags from the list.

You can use TagsSupported to determine whether a certain file format supports tags.


This example will show all the tags in the give file, read them then saves them to another file

using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
string tagsFileName; 
IList<RasterTagMetadata> myTags; 
void EnumTagsExample(string srcFileName, string destFileName) 
	RasterCodecs codecs = new RasterCodecs(); 
	tagsFileName = srcFileName; 
	myTags = new List<RasterTagMetadata>(); 
	codecs.TagFound += new EventHandler<CodecsEnumTagsEventArgs>(codecs_TagFound); 
	codecs.EnumTags(srcFileName, 1); 
	codecs.TagFound -= new EventHandler<CodecsEnumTagsEventArgs>(codecs_TagFound); 
	// We read all the tags now, save them to the file 
	Console.WriteLine("{0} tags read, saving them to the destination file", myTags.Count); 
	codecs.WriteTags(destFileName, 1, myTags); 
	// Clean up 
void codecs_TagFound(object sender, CodecsEnumTagsEventArgs e) 
	Console.WriteLine("Tag: Id={0}, Count={1}, Type={2}", e.Id, e.Count, e.MetadataType); 
	// Read this tag from the file and add it to our collection 
	RasterCodecs codecs = sender as RasterCodecs; 
	RasterTagMetadata tag = codecs.ReadTag(tagsFileName, 1, e.Id); 

Target Platforms

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

Leadtools.Codecs Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.