The collection of tag data used when reading and writing certain file formats (including TIFF).
public Leadtools.RasterCollection<RasterTagMetadata> Tags {get;} Public ReadOnly Property Tags As Leadtools.RasterCollection(Of RasterTagMetadata) public Leadtools.RasterCollection<RasterTagMetadata> Tags {get;} @property (nonatomic, assign, readonly, nullable) NSMutableArray<LTRasterTagMetadata *> *tags public RasterCollection<RasterTagMetadata> getTags() get_Tags(); public:property Leadtools.RasterCollection<RasterTagMetadata^>^ Tags {Leadtools.RasterCollection<RasterTagMetadata^>^ get();}
A collection of RasterTagMetadata used when reading and writing certain file formats (including TIFF).
Several formats allow you to store non-image data such as comments, tags, and markers.
You can manipulate the tags of an image by adding/removing RasterTagMetadata objects to this collection.
By setting the CodecsSaveOptions.Tags property to true before calling RasterCodecs.Save, you can save the tags in this collection when the image is saved into a file.
By setting the CodecsLoadOptions.Markers property to true before calling RasterCodecs.Load, you can load all the markers (if any) into this collection when an image is loaded from a file.
You can use the RasterCodecs.WriteTags method to save the tags directly to an existing file and the RasterCodecs.EnumTags to load the tags stored in an existing file.
Note: To write tags to a TIFF file, use RasterCodecs.WriteTags instead of using RasterImage.Tags followed by RasterCodecs.Save.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Core;using Leadtools.ImageProcessing.Color;using Leadtools.Dicom;using Leadtools.Drawing;using Leadtools.Controls;using LeadtoolsExamples.Common;using Leadtools.Svg;private void DisplayTag(RasterTagMetadata tag){switch (tag.DataType){case RasterTagMetadataDataType.Ascii:MessageBox.Show("Tag " + tag.Id.ToString() + " = " + tag.ToAscii());break;case RasterTagMetadataDataType.Byte:MessageBox.Show("Tag " + tag.Id.ToString() + " = " + tag.ToByte()[0].ToString());break;}}public void TagsExample(){RasterCodecs codecs = new RasterCodecs();RasterImage image = codecs.Load(Path.Combine(ImagesPath.Path, "IMAGE1.CMP"));//AsciiRasterTagMetadata tagDataAscii = new RasterTagMetadata();// set the Copyright tagtagDataAscii.Id = 0x8000;tagDataAscii.DataType = RasterTagMetadataDataType.Ascii;tagDataAscii.FromAscii("Test String");image.Tags.Add(tagDataAscii);//ByteRasterTagMetadata tagDataByte = tagDataAscii.Clone();tagDataByte.Id = 0x8001;tagDataByte.DataType = RasterTagMetadataDataType.Byte;byte[] byteArray = new byte[1];byteArray[0] = 10;tagDataByte.FromByte(byteArray);image.Tags.Add(tagDataByte);codecs.Options.Save.Tags = true;codecs.Save(image, Path.Combine(ImagesPath.Path, "IMAGE1_TAGS.TIF"), RasterImageFormat.Tif, 0);// load the tags together with the imageRasterTagMetadata tag = codecs.ReadTag(Path.Combine(ImagesPath.Path, "IMAGE1_TAGS.TIF"), 1, 0x8000);DisplayTag(tag);tag = codecs.ReadTag(Path.Combine(ImagesPath.Path, "IMAGE1_TAGS.TIF"), 1, 0x8001);DisplayTag(tag);codecs.Dispose();}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.CoreImports Leadtools.ImageProcessing.ColorImports Leadtools.ControlsImports Leadtools.DicomImports Leadtools.DrawingImports Leadtools.SvgPrivate Sub DisplayTag(ByVal tag As RasterTagMetadata)Select Case tag.DataTypeCase RasterTagMetadataDataType.AsciiMessageBox.Show("Tag " & tag.Id.ToString() & " = " & tag.ToAscii())Case RasterTagMetadataDataType.ByteMessageBox.Show("Tag " & tag.Id.ToString() & " = " & tag.ToByte()(0).ToString())End SelectEnd SubPublic Sub TagsExample()Dim codecs As RasterCodecs = New RasterCodecs()Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP"))'AsciiDim tagDataAscii As RasterTagMetadata = New RasterTagMetadata()' set the Copyright tagtagDataAscii.Id = &H8000tagDataAscii.DataType = RasterTagMetadataDataType.AsciitagDataAscii.FromAscii("Test String")image.Tags.Add(tagDataAscii)'ByteDim tagDataByte As RasterTagMetadata = tagDataAscii.Clone()tagDataByte.Id = &H8001tagDataByte.DataType = RasterTagMetadataDataType.ByteDim byteArray As Byte() = New Byte(0) {}byteArray(0) = 10tagDataByte.FromByte(byteArray)image.Tags.Add(tagDataByte)codecs.Options.Save.Tags = Truecodecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_TAGS.TIF"), RasterImageFormat.Tif, 0)' load the tags together with the imageDim tag As RasterTagMetadata = codecs.ReadTag(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_TAGS.TIF"), 1, &H8000)DisplayTag(tag)tag = codecs.ReadTag(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_TAGS.TIF"), 1, &H8001)DisplayTag(tag)codecs.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Dicom;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Core;using Leadtools.ImageProcessing.Color;using Leadtools.Examples;using Leadtools.Windows.Media;private void DisplayTag(RasterTagMetadata tag){switch (tag.DataType){case RasterTagMetadataDataType.Ascii:Debug.WriteLine("Tag " + tag.Id.ToString() + " = " + tag.ToAscii());break;case RasterTagMetadataDataType.Byte:Debug.WriteLine("Tag " + tag.Id.ToString() + " = " + tag.ToByte()[0].ToString());break;}}public void TagsExample(RasterImage image, Stream destStream){//AsciiRasterTagMetadata tagDataAscii = new RasterTagMetadata();// set the Copyright tagtagDataAscii.Id = 0x8000;tagDataAscii.DataType = RasterTagMetadataDataType.Ascii;tagDataAscii.FromAscii("Test String");image.Tags.Add(tagDataAscii);//ByteRasterTagMetadata tagDataByte = tagDataAscii.Clone();tagDataByte = 0x8001;tagDataByte.DataType = RasterTagMetadataDataType.Byte;byte[] byteArray = new byte[1];byteArray[0] = 10;tagDataByte.FromByte(byteArray);image.Tags.Add(tagDataByte);RasterCodecs codecs = new RasterCodecs();codecs.Options.Save.Tags = true;codecs.Save(image, destStream, RasterImageFormat.Tif, 0);// load the tags together with the imageRasterTagMetadata tag = codecs.ReadTag(destStream, 1, 0x8000);DisplayTag(tag);tag = codecs.ReadTag(destStream, 1, 0x8001);DisplayTag(tag);}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.DicomImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.CoreImports Leadtools.ImageProcessing.ColorImports Leadtools.Windows.MediaPrivate Sub DisplayTag(ByVal tag As RasterTagMetadata)Select Case tag.DataTypeCase RasterTagMetadataDataType.AsciiDebug.WriteLine("Tag " & tag.Id.ToString() & " = " & tag.ToAscii())Case RasterTagMetadataDataType.ByteDebug.WriteLine("Tag " & tag.Id.ToString() & " = " & tag.ToByte()(0).ToString())End SelectEnd SubPublic Sub TagsExample(ByVal image As RasterImage, ByVal destStream As Stream)'AsciiDim tagDataAscii As RasterTagMetadata = New RasterTagMetadata()' set the Copyright tagtagDataAscii.Id = &H8000tagDataAscii.DataType = RasterTagMetadataDataType.AsciitagDataAscii.FromAscii("Test String")image.Tags.Add(tagDataAscii)'ByteDim tagDataByte As RasterTagMetadata = tagDataAscii.Clone()tagDataByte = &H8001tagDataByte.DataType = RasterTagMetadataDataType.ByteDim byteArray As Byte() = New Byte(0) {}byteArray(0) = 10tagDataByte.FromByte(byteArray)image.Tags.Add(tagDataByte)Dim codecs As RasterCodecs = New RasterCodecs()codecs.Options.Save.Tags = Truecodecs.Save(image, destStream, RasterImageFormat.Tif, 0)' load the tags together with the imageDim tag As RasterTagMetadata = codecs.ReadTag(destStream, 1, &H8000)DisplayTag(tag)tag = codecs.ReadTag(destStream, 1, &H8001)DisplayTag(tag)End Sub
|
Products |
Support |
Feedback: Tags Property - Leadtools |
Introduction |
Help Version 19.0.2017.6.19
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.