Leadtools.Codecs Namespace > RasterCodecs Class > ReadComment Method : ReadComment(String,Int32,RasterCommentMetadataType) Method |
public RasterCommentMetadata ReadComment( string fileName, int pageNumber, RasterCommentMetadataType type )
'Declaration Public Overloads Function ReadComment( _ ByVal fileName As String, _ ByVal pageNumber As Integer, _ ByVal type As RasterCommentMetadataType _ ) As RasterCommentMetadata
'Usage Dim instance As RasterCodecs Dim fileName As String Dim pageNumber As Integer Dim type As RasterCommentMetadataType Dim value As RasterCommentMetadata value = instance.ReadComment(fileName, pageNumber, type)
public RasterCommentMetadata ReadComment( string fileName, int pageNumber, RasterCommentMetadataType type )
function Leadtools.Codecs.RasterCodecs.ReadComment(String,Int32,RasterCommentMetadataType)( fileName , pageNumber , type )
public: RasterCommentMetadata^ ReadComment( String^ fileName, int pageNumber, RasterCommentMetadataType type )
Some file formats can contain comments, and some cannot, and each file format has its own set of comment types. When you save a file, the comments in the Leadtools.RasterImage object can be saved in the file. The index into the array (specified using a constant) determines the type of comment.
You can use CommentsSupported to determine whether a certain file format supports tags.
To read all the comments stored in a file, use ReadComments(String,Int32).
Public Sub CommentsExample() Dim codecs As RasterCodecs = New RasterCodecs() Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp") Dim destFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1_Comments.tif") ' Convert the source file to TIF Console.WriteLine("Converting the source file to TIF") codecs.Convert(srcFileName, destFileName, RasterImageFormat.Tif, 0, 0, 24, Nothing) ' Add the artist comment Dim writeComment As RasterCommentMetadata = New RasterCommentMetadata() writeComment.Type = RasterCommentMetadataType.Artist writeComment.FromAscii("LEADTOOLS") Console.WriteLine("Writing the following comment:") Console.WriteLine(" Type:{0}, Data:{1}", writeComment.Type, writeComment.ToAscii()) codecs.WriteComment(destFileName, 1, writeComment) ' Read the comment back Dim readComment As RasterCommentMetadata = codecs.ReadComment(destFileName, 1, RasterCommentMetadataType.Artist) Console.WriteLine("The following comment has been read:") Console.WriteLine(" Type:{0}, Data:{1}", readComment.Type, readComment.ToAscii()) ' Write a few comments to the file in one pass Dim comments As RasterCollection(Of RasterCommentMetadata) = New RasterCollection(Of RasterCommentMetadata)() writeComment = New RasterCommentMetadata() writeComment.Type = RasterCommentMetadataType.Artist writeComment.FromAscii("LEADTOOLS Again") comments.Add(writeComment) writeComment = New RasterCommentMetadata() writeComment.Type = RasterCommentMetadataType.Copyright writeComment.FromAscii("(c) 2006") comments.Add(writeComment) Console.WriteLine("Writing the following comments to the file:") For Each comment As RasterCommentMetadata In comments Console.WriteLine(" Type:{0}, Data:{1}", comment.Type, comment.ToAscii()) Next comment codecs.WriteComments(destFileName, 1, comments) ' Now get all the comments in the file and show them: Console.WriteLine("Reading all comments from the file:") Dim tifComments As RasterCommentMetadataType() = _ { _ RasterCommentMetadataType.Artist, _ RasterCommentMetadataType.Copyright, _ RasterCommentMetadataType.DateTime, _ RasterCommentMetadataType.Description, _ RasterCommentMetadataType.HostComputer, _ RasterCommentMetadataType.Make, _ RasterCommentMetadataType.Model, _ RasterCommentMetadataType.NameOfDocument, _ RasterCommentMetadataType.NameOfPage, _ RasterCommentMetadataType.Software _ } For Each tifComment As RasterCommentMetadataType In tifComments Dim comment As RasterCommentMetadata = codecs.ReadComment(destFileName, 1, tifComment) If Not comment Is Nothing Then Console.Write("Found comment, Type:{0}, Data:", comment.Type) Dim dataType As RasterCommentMetadataDataType = RasterCommentMetadata.GetDataType(comment.Type) Dim byteData As Byte() Dim shortData As Short() Dim rationalData As RasterMetadataRational() Dim urationalData As RasterMetadataURational() Select Case dataType Case RasterCommentMetadataDataType.Ascii Console.WriteLine(comment.ToAscii()) Case RasterCommentMetadataDataType.Byte byteData = comment.ToByte() Dim i As Integer = 0 Do While i < byteData.Length Console.Write("{0:X} ", byteData(i)) i += 1 Loop Console.WriteLine() Case RasterCommentMetadataDataType.Int16 shortData = comment.ToInt16() Dim i As Integer = 0 Do While i < shortData.Length Console.Write("{0:X} ", shortData(i)) i += 1 Loop Console.WriteLine() Case RasterCommentMetadataDataType.Rational rationalData = comment.ToRational() Dim i As Integer = 0 Do While i < rationalData.Length Console.Write("{0}/{1) ", rationalData(i).Numerator, rationalData(i).Denominator) i += 1 Loop Console.WriteLine() Case RasterCommentMetadataDataType.URational urationalData = comment.ToURational() Dim i As Integer = 0 Do While i < urationalData.Length Console.Write("{0}/{1) ", urationalData(i).Numerator, urationalData(i).Denominator) i += 1 Loop Console.WriteLine() End Select End If Next tifComment ' Clean up codecs.Dispose() End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
public void CommentsExample() { RasterCodecs codecs = new RasterCodecs(); string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"); string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1_Comments.tif"); // Convert the source file to TIF Console.WriteLine("Converting the source file to TIF"); codecs.Convert(srcFileName, destFileName, RasterImageFormat.Tif, 0, 0, 24, null); // Add the artist comment RasterCommentMetadata writeComment = new RasterCommentMetadata(); writeComment.Type = RasterCommentMetadataType.Artist; writeComment.FromAscii("LEADTOOLS"); Console.WriteLine("Writing the following comment:"); Console.WriteLine(" Type:{0}, Data:{1}", writeComment.Type, writeComment.ToAscii()); codecs.WriteComment(destFileName, 1, writeComment); // Read the comment back RasterCommentMetadata readComment = codecs.ReadComment(destFileName, 1, RasterCommentMetadataType.Artist); Console.WriteLine("The following comment has been read:"); Console.WriteLine(" Type:{0}, Data:{1}", readComment.Type, readComment.ToAscii()); // Write a few comments to the file in one pass RasterCollection<RasterCommentMetadata> comments = new RasterCollection<RasterCommentMetadata>(); writeComment = new RasterCommentMetadata(); writeComment.Type = RasterCommentMetadataType.Artist; writeComment.FromAscii("LEADTOOLS Again"); comments.Add(writeComment); writeComment = new RasterCommentMetadata(); writeComment.Type = RasterCommentMetadataType.Copyright; writeComment.FromAscii("(c) 2006"); comments.Add(writeComment); Console.WriteLine("Writing the following comments to the file:"); foreach (RasterCommentMetadata comment in comments) Console.WriteLine(" Type:{0}, Data:{1}", comment.Type, comment.ToAscii()); codecs.WriteComments(destFileName, 1, comments); // Now get all the comments in the file and show them: Console.WriteLine("Reading all comments from the file:"); RasterCommentMetadataType[] tifComments = { RasterCommentMetadataType.Artist, RasterCommentMetadataType.Copyright, RasterCommentMetadataType.DateTime, RasterCommentMetadataType.Description, RasterCommentMetadataType.HostComputer, RasterCommentMetadataType.Make, RasterCommentMetadataType.Model, RasterCommentMetadataType.NameOfDocument, RasterCommentMetadataType.NameOfPage, RasterCommentMetadataType.Software, }; foreach (RasterCommentMetadataType tifComment in tifComments) { RasterCommentMetadata comment = codecs.ReadComment(destFileName, 1, tifComment); if (comment != null) { Console.Write("Found comment, Type:{0}, Data:", comment.Type); RasterCommentMetadataDataType dataType = RasterCommentMetadata.GetDataType(comment.Type); byte[] byteData; short[] shortData; RasterMetadataRational[] rationalData; RasterMetadataURational[] urationalData; switch (dataType) { case RasterCommentMetadataDataType.Ascii: Console.WriteLine(comment.ToAscii()); break; case RasterCommentMetadataDataType.Byte: byteData = comment.ToByte(); for (int i = 0; i < byteData.Length; i++) Console.Write("{0:X} ", byteData[i]); Console.WriteLine(); break; case RasterCommentMetadataDataType.Int16: shortData = comment.ToInt16(); for (int i = 0; i < shortData.Length; i++) Console.Write("{0:X} ", shortData[i]); Console.WriteLine(); break; case RasterCommentMetadataDataType.Rational: rationalData = comment.ToRational(); for (int i = 0; i < rationalData.Length; i++) Console.Write(@"{0}/{1) ", rationalData[i].Numerator, rationalData[i].Denominator); Console.WriteLine(); break; case RasterCommentMetadataDataType.URational: urationalData = comment.ToURational(); for (int i = 0; i < urationalData.Length; i++) Console.Write(@"{0}/{1) ", urationalData[i].Numerator, urationalData[i].Denominator); Console.WriteLine(); break; } } } // Clean up codecs.Dispose(); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
RasterCodecsExamples.prototype.CommentsExample = function ( ) { Tools.SetLicense ( ) ; with ( Leadtools ) { with ( Leadtools.Codecs ) { var codecs = new RasterCodecs(); var srcFileName = "Assets\\Image1.cmp"; var destFileName = "Image1_Comments.tif"; var saveFile ; var loadFile; // Convert the source file to TIF return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function (loadFileX) { loadFile = loadFileX; return Tools.AppLocalFolder().createFileAsync(destFileName)}) .then ( function ( saveFileX ) { saveFile = saveFileX ; console.info("Converting the source file to TIF"); return codecs.convertAsync(LeadStreamFactory.create(loadFile), LeadStreamFactory.create(saveFile), RasterImageFormat.tif, 0, 0, 24, null)}) .then ( function ( ) { // Add the artist comment var writeComment = new RasterCommentMetadata(); writeComment.type = RasterCommentMetadataType.artist; writeComment.fromAscii("LEADTOOLS"); console.info("Writing the following comment:"); console.info(" Type:", writeComment.type, ", Data:", writeComment.toAscii()); return codecs.writeCommentAsync(LeadStreamFactory.create(saveFile), 1, writeComment)}) .then ( function ( ) { // Read the comment back return codecs.readCommentAsync(LeadStreamFactory.create(saveFile), 1, RasterCommentMetadataType.artist)}) .then ( function ( readComment ) { console.info("The following comment has been read:"); console.info(" Type:", readComment.type, ", Data:", readComment.toAscii()); // Write a few comments to the file in one pass var comments = []; writeComment = new RasterCommentMetadata(); writeComment.Type = RasterCommentMetadataType.artist; writeComment.fromAscii("LEADTOOLS Again"); comments[0] = writeComment; writeComment = new RasterCommentMetadata(); writeComment.type = RasterCommentMetadataType.copyright; writeComment.fromAscii("(c) 2006"); comments[1]= writeComment; console.info("Writing the following comments to the file:"); for (var i=0; i < comments.length;i++) { var comment = comments[i]; console.info(" Type:", comment.type, ", Data:", comment.toAscii()); } return codecs.writeCommentsAsync(LeadStreamFactory.create(saveFile), 1, comments) }) .then ( function ( ) { // Now get all the comments in the file and show them: Debug.writeln("Reading all comments from the file:"); var tifComments = [ RasterCommentMetadataType.artist, RasterCommentMetadataType.copyright, RasterCommentMetadataType.dateTime, RasterCommentMetadataType.description, RasterCommentMetadataType.hostComputer, RasterCommentMetadataType.make, RasterCommentMetadataType.model, RasterCommentMetadataType.nameOfDocument, RasterCommentMetadataType.nameOfPage, RasterCommentMetadataType.Software ]; var promises = tifComments.map ( function ( tifComment ) { return codecs.readCommentAsync(LeadStreamFactory.create(saveFile), 1, tifComment).then ( function ( comment ) { if (comment != null) { console.info("Found comment, Type:", comment.type, ", Data:"); var dataType = RasterCommentMetadata.getDataType(comment.Type); var byteData; var shortData; var rationalData; var urationalData; switch (dataType) { case RasterCommentMetadataDataType.ascii: console.info(comment.toAscii()); break; case RasterCommentMetadataDataType.byte: byteData = comment.toByte(); for (var i = 0; i < byteData.length; i++) console.info(byteData[i]); console.info(""); break; case RasterCommentMetadataDataType.int16: shortData = comment.toInt16(); for (var i = 0; i < shortData.length; i++) console.info(shortData[i]); console.info(""); break; case RasterCommentMetadataDataType.rational: rationalData = comment.toRational(); for (var i = 0; i < rationalData.length; i++) console.info(rationalData[i].numerator, "//", rationalData[i].denominator); console.info(""); break; case RasterCommentMetadataDataType.urational: urationalData = comment.toURational(); for (var i = 0; i < urationalData.length; i++) console.info(urationalData[i].numerator, "//", urationalData[i].denominator); console.info(""); break; } } }); }); return WinJS.Promise.join ( promises )}) .then ( function ( ) { // Clean up codecs.close();}); } } }
[TestMethod] public async Task CommentsExample() { RasterCodecs codecs = new RasterCodecs(); string srcFileName = @"Assets\Image1.cmp"; string destFileName = "Image1_Comments.tif"; // Convert the source file to TIF StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName); StorageFile saveFile = await Tools.AppLocalFolder.CreateFileAsync(destFileName); Debug.WriteLine("Converting the source file to TIF"); await codecs.ConvertAsync(LeadStreamFactory.Create(loadFile), LeadStreamFactory.Create(saveFile), RasterImageFormat.Tif, 0, 0, 24, null); // Add the artist comment RasterCommentMetadata writeComment = new RasterCommentMetadata(); writeComment.Type = RasterCommentMetadataType.Artist; writeComment.FromAscii("LEADTOOLS"); Debug.WriteLine("Writing the following comment:"); Debug.WriteLine(" Type:{0}, Data:{1}", writeComment.Type, writeComment.ToAscii()); await codecs.WriteCommentAsync(LeadStreamFactory.Create(saveFile), 1, writeComment); // Read the comment back RasterCommentMetadata readComment = await codecs.ReadCommentAsync(LeadStreamFactory.Create(saveFile), 1, RasterCommentMetadataType.Artist); Debug.WriteLine("The following comment has been read:"); Debug.WriteLine(" Type:{0}, Data:{1}", readComment.Type, readComment.ToAscii()); // Write a few comments to the file in one pass List<RasterCommentMetadata> comments = new List<RasterCommentMetadata>(); writeComment = new RasterCommentMetadata(); writeComment.Type = RasterCommentMetadataType.Artist; writeComment.FromAscii("LEADTOOLS Again"); comments.Add(writeComment); writeComment = new RasterCommentMetadata(); writeComment.Type = RasterCommentMetadataType.Copyright; writeComment.FromAscii("(c) 2006"); comments.Add(writeComment); Debug.WriteLine("Writing the following comments to the file:"); foreach (RasterCommentMetadata comment in comments) Debug.WriteLine(" Type:{0}, Data:{1}", comment.Type, comment.ToAscii()); await codecs.WriteCommentsAsync(LeadStreamFactory.Create(saveFile), 1, comments); // Now get all the comments in the file and show them: Debug.WriteLine("Reading all comments from the file:"); RasterCommentMetadataType[] tifComments = { RasterCommentMetadataType.Artist, RasterCommentMetadataType.Copyright, RasterCommentMetadataType.DateTime, RasterCommentMetadataType.Description, RasterCommentMetadataType.HostComputer, RasterCommentMetadataType.Make, RasterCommentMetadataType.Model, RasterCommentMetadataType.NameOfDocument, RasterCommentMetadataType.NameOfPage, RasterCommentMetadataType.Software, }; foreach (RasterCommentMetadataType tifComment in tifComments) { RasterCommentMetadata comment = await codecs.ReadCommentAsync(LeadStreamFactory.Create(saveFile), 1, tifComment); if (comment != null) { Debug.WriteLine("Found comment, Type:{0}, Data:", comment.Type); RasterCommentMetadataDataType dataType = RasterCommentMetadata.GetDataType(comment.Type); byte[] byteData; short[] shortData; RasterMetadataRational[] rationalData; RasterMetadataURational[] urationalData; switch (dataType) { case RasterCommentMetadataDataType.Ascii: Debug.WriteLine(comment.ToAscii()); break; case RasterCommentMetadataDataType.Byte: byteData = comment.ToByte(); for (int i = 0; i < byteData.Length; i++) Debug.WriteLine("{0:X} ", byteData[i]); Debug.WriteLine(""); break; case RasterCommentMetadataDataType.Int16: shortData = comment.ToInt16(); for (int i = 0; i < shortData.Length; i++) Debug.WriteLine("{0:X} ", shortData[i]); Debug.WriteLine(""); break; case RasterCommentMetadataDataType.Rational: rationalData = comment.ToRational(); for (int i = 0; i < rationalData.Length; i++) Debug.WriteLine(@"{0}/{1) ", rationalData[i].Numerator, rationalData[i].Denominator); Debug.WriteLine(""); break; case RasterCommentMetadataDataType.URational: urationalData = comment.ToURational(); for (int i = 0; i < urationalData.Length; i++) Debug.WriteLine(@"{0}/{1) ", urationalData[i].Numerator, urationalData[i].Denominator); Debug.WriteLine(""); break; } } } // Clean up codecs.Dispose(); }
public void CommentsExample(Stream inStreamCmp, Stream outStreamTif) { RasterCodecs codecs = new RasterCodecs(); // Convert the source file to TIF Debug.WriteLine("Converting the source file to TIF"); codecs.Convert(inStreamCmp, outStreamTif, RasterImageFormat.Tif, 0, 0, 24, null); // Add the artist comment RasterCommentMetadata writeComment = new RasterCommentMetadata(); writeComment.Type = RasterCommentMetadataType.Artist; writeComment.FromAscii("LEADTOOLS"); Debug.WriteLine("Writing the following comment:"); Debug.WriteLine(" Type:{0}, Data:{1}", writeComment.Type, writeComment.ToAscii()); codecs.WriteComment(outStreamTif, 1, writeComment); // Read the comment back RasterCommentMetadata readComment = codecs.ReadComment(outStreamTif, 1, RasterCommentMetadataType.Artist); Debug.WriteLine("The following comment has been read:"); Debug.WriteLine(" Type:{0}, Data:{1}", readComment.Type, readComment.ToAscii()); // Write a few comments to the file in one pass RasterCollection<RasterCommentMetadata> comments = new RasterCollection<RasterCommentMetadata>(); writeComment = new RasterCommentMetadata(); writeComment.Type = RasterCommentMetadataType.Artist; writeComment.FromAscii("LEADTOOLS Again"); comments.Add(writeComment); writeComment = new RasterCommentMetadata(); writeComment.Type = RasterCommentMetadataType.Copyright; writeComment.FromAscii("(c) 2006"); comments.Add(writeComment); Debug.WriteLine("Writing the following comments to the file:"); foreach(RasterCommentMetadata comment in comments) Debug.WriteLine(" Type:{0}, Data:{1}", comment.Type, comment.ToAscii()); codecs.WriteComments(outStreamTif, 1, comments); // Now get all the comments in the file and show them: Debug.WriteLine("Reading all comments from the file:"); RasterCommentMetadataType[] tifComments = { RasterCommentMetadataType.Artist, RasterCommentMetadataType.Copyright, RasterCommentMetadataType.DateTime, RasterCommentMetadataType.Description, RasterCommentMetadataType.HostComputer, RasterCommentMetadataType.Make, RasterCommentMetadataType.Model, RasterCommentMetadataType.NameOfDocument, RasterCommentMetadataType.NameOfPage, RasterCommentMetadataType.Software, }; foreach(RasterCommentMetadataType tifComment in tifComments) { RasterCommentMetadata comment = codecs.ReadComment(outStreamTif, 1, tifComment); if(comment != null) { Debug.WriteLine("Found comment, Type:{0}, Data:", comment.Type); RasterCommentMetadataDataType dataType = RasterCommentMetadata.GetDataType(comment.Type); byte[] byteData; short[] shortData; RasterMetadataRational[] rationalData; RasterMetadataURational[] urationalData; switch(dataType) { case RasterCommentMetadataDataType.Ascii: Debug.WriteLine(comment.ToAscii()); break; case RasterCommentMetadataDataType.Byte: byteData = comment.ToByte(); for(int i = 0; i < byteData.Length; i++) Debug.WriteLine("{0:X} ", byteData[i]); Debug.WriteLine(""); break; case RasterCommentMetadataDataType.Int16: shortData = comment.ToInt16(); for(int i = 0; i < shortData.Length; i++) Debug.WriteLine("{0:X} ", shortData[i]); Debug.WriteLine(""); break; case RasterCommentMetadataDataType.Rational: rationalData = comment.ToRational(); for(int i = 0; i < rationalData.Length; i++) Debug.WriteLine(@"{0}/{1) ", rationalData[i].Numerator, rationalData[i].Denominator); Debug.WriteLine(""); break; case RasterCommentMetadataDataType.URational: urationalData = comment.ToURational(); for(int i = 0; i < urationalData.Length; i++) Debug.WriteLine(@"{0}/{1) ", urationalData[i].Numerator, urationalData[i].Denominator); Debug.WriteLine(""); break; } } } }
Public Sub CommentsExample(ByVal inStreamCmp As Stream, ByVal outStreamTif As Stream)
Dim codecs As RasterCodecs = New RasterCodecs()
' Convert the source file to TIF
Debug.WriteLine("Converting the source file to TIF")
codecs.Convert(inStreamCmp, outStreamTif, RasterImageFormat.Tif, 0, 0, 24, Nothing)
' Add the artist comment
Dim writeComment As RasterCommentMetadata = New RasterCommentMetadata()
writeComment.Type = RasterCommentMetadataType.Artist
writeComment.FromAscii("LEADTOOLS")
Debug.WriteLine("Writing the following comment:")
Debug.WriteLine(" Type:{0}, Data:{1}", writeComment.Type, writeComment.ToAscii())
codecs.WriteComment(outStreamTif, 1, writeComment)
' Read the comment back
Dim readComment As RasterCommentMetadata = codecs.ReadComment(outStreamTif, 1, RasterCommentMetadataType.Artist)
Debug.WriteLine("The following comment has been read:")
Debug.WriteLine(" Type:{0}, Data:{1}", readComment.Type, readComment.ToAscii())
' Write a few comments to the file in one pass
Dim comments As RasterCollection(Of RasterCommentMetadata) = New RasterCollection(Of RasterCommentMetadata)()
writeComment = New RasterCommentMetadata()
writeComment.Type = RasterCommentMetadataType.Artist
writeComment.FromAscii("LEADTOOLS Again")
comments.Add(writeComment)
writeComment = New RasterCommentMetadata()
writeComment.Type = RasterCommentMetadataType.Copyright
writeComment.FromAscii("(c) 2006")
comments.Add(writeComment)
Debug.WriteLine("Writing the following comments to the file:")
For Each comment As RasterCommentMetadata In comments
Debug.WriteLine(" Type:{0}, Data:{1}", comment.Type, comment.ToAscii())
Next comment
codecs.WriteComments(outStreamTif, 1, comments)
' Now get all the comments in the file and show them:
Debug.WriteLine("Reading all comments from the file:")
Dim tifComments As RasterCommentMetadataType() = {RasterCommentMetadataType.Artist, RasterCommentMetadataType.Copyright, RasterCommentMetadataType.DateTime, RasterCommentMetadataType.Description, RasterCommentMetadataType.HostComputer, RasterCommentMetadataType.Make, RasterCommentMetadataType.Model, RasterCommentMetadataType.NameOfDocument, RasterCommentMetadataType.NameOfPage, RasterCommentMetadataType.Software}
For Each tifComment As RasterCommentMetadataType In tifComments
Dim comment As RasterCommentMetadata = codecs.ReadComment(outStreamTif, 1, tifComment)
If Not comment Is Nothing Then
Debug.WriteLine("Found comment, Type:{0}, Data:", comment.Type)
Dim dataType As RasterCommentMetadataDataType = RasterCommentMetadata.GetDataType(comment.Type)
Dim byteData As Byte()
Dim shortData As Short()
Dim rationalData As RasterMetadataRational()
Dim urationalData As RasterMetadataURational()
Select Case dataType
Case RasterCommentMetadataDataType.Ascii
Debug.WriteLine(comment.ToAscii())
Case RasterCommentMetadataDataType.Byte
byteData = comment.ToByte()
Dim i As Integer = 0
Do While i < byteData.Length
Debug.WriteLine("{0:X} ", byteData(i))
i += 1
Loop
Debug.WriteLine("")
Case RasterCommentMetadataDataType.Int16
shortData = comment.ToInt16()
Dim i As Integer = 0
Do While i < shortData.Length
Debug.WriteLine("{0:X} ", shortData(i))
i += 1
Loop
Debug.WriteLine("")
Case RasterCommentMetadataDataType.Rational
rationalData = comment.ToRational()
Dim i As Integer = 0
Do While i < rationalData.Length
Debug.WriteLine("{0}/{1) ", rationalData(i).Numerator, rationalData(i).Denominator)
i += 1
Loop
Debug.WriteLine("")
Case RasterCommentMetadataDataType.URational
urationalData = comment.ToURational()
Dim i As Integer = 0
Do While i < urationalData.Length
Debug.WriteLine("{0}/{1) ", urationalData(i).Numerator, urationalData(i).Denominator)
i += 1
Loop
Debug.WriteLine("")
End Select
End If
Next tifComment
End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2