The collection of comment data used when reading and writing certain file formats (including GIF).
public RasterCollection<RasterCommentMetadata> Comments { get; } Public ReadOnly Property Comments As Leadtools.RasterCollection(Of RasterCommentMetadata) public Leadtools.RasterCollection<RasterCommentMetadata> Comments {get;} @property (nonatomic, assign, readonly, nullable) NSMutableArray<LTRasterCommentMetadata *> *comments public RasterCollection<RasterCommentMetadata> getComments() get_Comments(); public:property Leadtools.RasterCollection<RasterCommentMetadata^>^ Comments {Leadtools.RasterCollection<RasterCommentMetadata^>^ get();}
A collection of RasterCommentMetadata used when reading and writing certain file formats (including GIF).
Several formats allow you to store non-image data such as comments, tags, and markers.
You can manipulate the comments of an image by adding/removing RasterCommentMetadata objects to this collection.
By setting the CodecsSaveOptions.Comments property to true before calling RasterCodecs.Save, you can save the comments 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.WriteMarkers method to save the markers directly to an existing file.
For more information, refer to Non Image Data and Types of File Comments.
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 DisplayComment(RasterCommentMetadata comment){switch (comment.DataType){case RasterCommentMetadataDataType.Ascii:MessageBox.Show("Comment of type " + comment.Type.ToString() + " = " + comment.ToAscii());break;}}public void CommentsExample(){RasterCodecs codecs = new RasterCodecs();RasterImage image = codecs.Load(Path.Combine(ImagesPath.Path, "IMAGE1.CMP"));//AsciiRasterCommentMetadata commentDataAscii = new RasterCommentMetadata();// set the artist commentcommentDataAscii.Type = RasterCommentMetadataType.Artist;commentDataAscii.FromAscii("Test String");image.Comments.Add(commentDataAscii);codecs.Options.Save.Comments = true;codecs.Save(image, Path.Combine(ImagesPath.Path, "IMAGE1_COMMENTS.TIF"), RasterImageFormat.Tif, 0);// load the comment together with the imageRasterCommentMetadata comment = codecs.ReadComment(Path.Combine(ImagesPath.Path, "IMAGE1_COMMENTS.TIF"), 1, RasterCommentMetadataType.Artist);DisplayComment(comment);codecs.Dispose();}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.CoreImports Leadtools.ImageProcessing.ColorImports Leadtools.ControlsImports Leadtools.DicomImports Leadtools.DrawingImports Leadtools.SvgPrivate Sub DisplayComment(ByVal comment As RasterCommentMetadata)Select Case comment.DataTypeCase RasterCommentMetadataDataType.AsciiMessageBox.Show("Comment of type " & comment.Type.ToString() & " = " & comment.ToAscii())End SelectEnd SubPublic Sub CommentsExample()Dim codecs As RasterCodecs = New RasterCodecs()Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP"))'AsciiDim commentDataAscii As RasterCommentMetadata = New RasterCommentMetadata()' set the artist commentcommentDataAscii.Type = RasterCommentMetadataType.ArtistcommentDataAscii.FromAscii("Test String")image.Comments.Add(commentDataAscii)codecs.Options.Save.Comments = Truecodecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_COMMENTS.TIF"), RasterImageFormat.Tif, 0)' load the comment together with the imageDim comment As RasterCommentMetadata = codecs.ReadComment(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_COMMENTS.TIF"), 1,RasterCommentMetadataType.Artist)DisplayComment(comment)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 DisplayComment(RasterCommentMetadata comment){switch (comment.DataType){case RasterCommentMetadataDataType.Ascii:Debug.WriteLine("Comment of type " + comment.Type.ToString() + " = " + comment.ToAscii());break;}}public void CommentsExample(RasterImage image, Stream destStream){//AsciiRasterCommentMetadata commentDataAscii = new RasterCommentMetadata();// set the artist commentcommentDataAscii.Type = RasterCommentMetadataType.Artist;commentDataAscii.FromAscii("Test String");image.Comments.Add(commentDataAscii);RasterCodecs codecs = new RasterCodecs();codecs.Options.Save.Comments = true;codecs.Save(image, destStream, RasterImageFormat.Tif, 0);// load the comment together with the imageRasterCommentMetadata comment = codecs.ReadComment(destStream, 1, RasterCommentMetadataType.Artist);DisplayComment(comment);}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.DicomImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.CoreImports Leadtools.ImageProcessing.ColorImports Leadtools.Windows.MediaPrivate Sub DisplayComment(ByVal comment As RasterCommentMetadata)Select Case comment.DataTypeCase RasterCommentMetadataDataType.AsciiDebug.WriteLine("Comment of type " & comment.Type.ToString() & " = " & comment.ToAscii())End SelectEnd SubPublic Sub CommentsExample(ByVal image As RasterImage, ByVal destStream As Stream)'AsciiDim commentDataAscii As RasterCommentMetadata = New RasterCommentMetadata()' set the artist commentcommentDataAscii.Type = RasterCommentMetadataType.ArtistcommentDataAscii.FromAscii("Test String")image.Comments.Add(commentDataAscii)Dim codecs As RasterCodecs = New RasterCodecs()codecs.Options.Save.Comments = Truecodecs.Save(image, destStream, RasterImageFormat.Tif, 0)' load the comment together with the imageDim comment As RasterCommentMetadata = codecs.ReadComment(destStream, 1, RasterCommentMetadataType.Artist)DisplayComment(comment)End Sub
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
