Gets or sets a value that indicates whether any tags found in the file should be automatically loaded.
public bool Tags { get; set; } Public Property Tags As Boolean @property (nonatomic, assign) BOOL tags public boolean getTags()public void setTags(boolean value)
true to automatically load any tags found in the file; otherwise it is false.
When the value of the Tags property is set to true, any subsequent load operation performed by this RasterCodecs object will automatically try to load all the tags found in the file and store them in the RasterImage.Tags collection of the resulting image.
Internally, the RasterCodecs object will call TagsSupported on the image and only tries to load the tags if the value returned was true.
When loading more than one page from a multipage file, only the tags found in the first page will be automatically loaded when the value of this property is set to true. To manually load all the tags in any page, use ReadTags.
You must set the value of the Markers property to false to enable automatically loading the tags. If the value of both Markers and Tags is set to true, then the markers will take take precedence and no tags will be loaded.
Note that any load method that uses tiles, offset or resizing will not load any file metadata automatically regardless of the value of this property.
This example will browse to a file and load it along with any tags, geo-keys and comments found.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using Leadtools.Svg;using LeadtoolsExamples.Common;public void MetadataAutoLoadExample(){// Prompt the user for an image filestring imageFileName = PromptForFileName();// Initialize LEADTOOLSusing (RasterCodecs codecs = new RasterCodecs()){CodecsLoadOptions loadOptions = codecs.Options.Load;// Make sure auto-loading of markers is turned off, otherwise,// markers take precedence over loading the other metadataloadOptions.Markers = false;// Automatically load any tags, comments and geokeys found in this fileloadOptions.Tags = true;loadOptions.Comments = true;loadOptions.GeoKeys = true;// Now load the imageusing (RasterImage image = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)){string txtFileName = Path.Combine(Path.GetDirectoryName(imageFileName),Path.GetFileNameWithoutExtension(imageFileName) + "_metadata.txt");using (StreamWriter writer = File.CreateText(txtFileName)){// Show its tagsShowTags(writer, "Tags", image.Tags);// Show its commentsShowComments(writer, image.Comments);// Show its geo keys (tags and geokeys use the same data type)ShowTags(writer, "GeoKeys", image.GeoKeys);}// Show the text file we createdSystem.Diagnostics.Process.Start(txtFileName);}}}private static void ShowTags(StreamWriter writer, string name, IList<RasterTagMetadata> tags){writer.WriteLine("{0}:", name);foreach (RasterTagMetadata tag in tags){writer.WriteLine("Id: 0x{0}, data length: {1}", tag.Id.ToString("X"), tag.GetData().Length);}writer.WriteLine();}private static void ShowComments(StreamWriter writer, IList<RasterCommentMetadata> comments){writer.WriteLine("Comments:");foreach (RasterCommentMetadata comment in comments){writer.WriteLine("Type: 0x{0}, data length: {1}", comment.Type, comment.GetData().Length);}writer.WriteLine();}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.ColorImports Leadtools.DrawingImports Leadtools.SvgPublic Sub MetadataAutoLoadExample()' Prompt the user for an image fileDim imageFileName As String = PromptForFileName()' Initialize LEADTOOLSUsing codecs As New RasterCodecs()Dim loadOptions As CodecsLoadOptions = codecs.Options.Load' Make sure auto-loading of markers is turned off, otherwise,' markers take precedence over loading the other metadataloadOptions.Markers = False' Automatically load any tags, comments and geokeys found in this fileloadOptions.Tags = TrueloadOptions.Comments = TrueloadOptions.GeoKeys = True' Now load the imageUsing image As RasterImage = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)Dim txtFileName As String = Path.Combine(Path.GetDirectoryName(imageFileName),Path.GetFileNameWithoutExtension(imageFileName) + "_metadata.txt")Using writer As StreamWriter = File.CreateText(txtFileName)' Show its tagsShowTags(writer, "Tags", image.Tags)' Show its commentsShowComments(writer, image.Comments)' Show its geo keys (tags and geokeys use the same data type)ShowTags(writer, "GeoKeys", image.GeoKeys)End Using' Show the text file we createdSystem.Diagnostics.Process.Start(txtFileName)End UsingEnd UsingEnd SubPrivate Shared Sub ShowTags(ByVal writer As StreamWriter, ByVal name As String, ByVal tags As IList(Of RasterTagMetadata))writer.WriteLine("{0}:", name)For Each tag As RasterTagMetadata In tagswriter.WriteLine("Id: 0x{0}, data length: {1}", tag.Id.ToString("X"), tag.GetData().Length)Nextwriter.WriteLine()End SubPrivate Shared Sub ShowComments(ByVal writer As StreamWriter, ByVal comments As IList(Of RasterCommentMetadata))writer.WriteLine("Comments:")For Each comment As RasterCommentMetadata In commentswriter.WriteLine("Type: 0x{0}, data length: {1}", comment.Type, comment.GetData().Length)Nextwriter.WriteLine()End Sub
c#[Silverlight C# Example]using Leadtools;using Leadtools.Codecs;using Leadtools.Examples;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using Leadtools.Windows.Media;public void MetadataAutoLoadExample(Stream inStreamImage, StreamWriter outStreamText){// Initialize LEADTOOLSRasterCodecs codecs = new RasterCodecs();{CodecsLoadOptions loadOptions = codecs.Options.Load;// Make sure auto-loading of markers is turned off, otherwise,// markers take precedence over loading the other metadataloadOptions.Markers = false;// Automatically load any tags, comments and geokeys found in this fileloadOptions.Tags = true;loadOptions.Comments = true;loadOptions.GeoKeys = true;using (RasterImage image = codecs.Load(inStreamImage, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)){// Show its tagsShowTags(outStreamText, "Tags", image.Tags);// Show its commentsShowComments(outStreamText, image.Comments);// Show its geo keys (tags and geokeys use the same data type)ShowTags(outStreamText, "GeoKeys", image.GeoKeys);}}}private static void ShowTags(StreamWriter writer, string name, RasterCollection<RasterTagMetadata> tags){writer.WriteLine("{0}:", name);foreach (RasterTagMetadata tag in tags){writer.WriteLine("Id: 0x{0}, data length: {1}", tag.Id.ToString("X"), tag.GetData().Length);}writer.WriteLine();}private static void ShowComments(StreamWriter writer, RasterCollection<RasterCommentMetadata> comments){writer.WriteLine("Comments:");foreach (RasterCommentMetadata comment in comments){writer.WriteLine("Type: 0x{0}, data length: {1}", comment.Type, comment.GetData().Length);}writer.WriteLine();}vb[Silverlight VB Example]Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.ColorImports Leadtools.Windows.MediaPublic Sub MetadataAutoLoadExample(ByVal inStreamImage As Stream, ByVal outStreamText As StreamWriter)' Initialize LEADTOOLSDim codecs As RasterCodecs = New RasterCodecs()Dim loadOptions As CodecsLoadOptions = codecs.Options.Load' Make sure auto-loading of markers is turned off, otherwise,' markers take precedence over loading the other metadataloadOptions.Markers = False' Automatically load any tags, comments and geokeys found in this fileloadOptions.Tags = TrueloadOptions.Comments = TrueloadOptions.GeoKeys = TrueUsing image As RasterImage = codecs.Load(inStreamImage, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)' Show its tagsShowTags(outStreamText, "Tags", image.Tags)' Show its commentsShowComments(outStreamText, image.Comments)' Show its geo keys (tags and geokeys use the same data type)ShowTags(outStreamText, "GeoKeys", image.GeoKeys)End UsingEnd SubPrivate Shared Sub ShowTags(ByVal writer As StreamWriter, ByVal name As String, ByVal tags As RasterCollection(Of RasterTagMetadata))writer.WriteLine("{0}:", name)For Each tag As RasterTagMetadata In tagswriter.WriteLine("Id: 0x{0}, data length: {1}", tag.Id.ToString("X"), tag.GetData().Length)Next tagwriter.WriteLine()End SubPrivate Shared Sub ShowComments(ByVal writer As StreamWriter, ByVal comments As RasterCollection(Of RasterCommentMetadata))writer.WriteLine("Comments:")For Each comment As RasterCommentMetadata In commentswriter.WriteLine("Type: 0x{0}, data length: {1}", comment.Type, comment.GetData().Length)Next commentwriter.WriteLine()End Sub
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
