LEADTOOLS Image File Support (Leadtools.Codecs assembly)

DeleteComment(Stream,Int32,RasterCommentMetadataType) Method

Show in webframe
Example 







A System.IO.Stream containing the input file data.
1-based index of the page from which to read the comment.
The type of comment. Refer to Types of File Comments.
Deletes a comment field from a file.
Syntax
public void DeleteComment( 
   Stream stream,
   int pageNumber,
   RasterCommentMetadataType type
)
'Declaration
 
Public Overloads Sub DeleteComment( _
   ByVal stream As Stream, _
   ByVal pageNumber As Integer, _
   ByVal type As RasterCommentMetadataType _
) 
'Usage
 
Dim instance As RasterCodecs
Dim stream As Stream
Dim pageNumber As Integer
Dim type As RasterCommentMetadataType
 
instance.DeleteComment(stream, pageNumber, type)
public void DeleteComment( 
   Stream stream,
   int pageNumber,
   RasterCommentMetadataType type
)

            

            
 function Leadtools.Codecs.RasterCodecs.DeleteComment(Stream,Int32,RasterCommentMetadataType)( 
   stream ,
   pageNumber ,
   type 
)
public:
void DeleteComment( 
   Stream^ stream,
   int pageNumber,
   RasterCommentMetadataType type
) 

Parameters

stream
A System.IO.Stream containing the input file data.
pageNumber
1-based index of the page from which to read the comment.
type
The type of comment. Refer to Types of File Comments.
Remarks

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).

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Drawing

Public Sub DeleteCommentExample()
   Dim codecs As New RasterCodecs()

   Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Test.jpg")

   Dim commentType As RasterCommentMetadataType = RasterCommentMetadataType.IptcKeywords
   Dim comment As RasterCommentMetadata = codecs.ReadComment(srcFileName, 1, commentType)
   If (comment Is Nothing) Then
      Debug.WriteLine("comment is already missing!")
   Else
      codecs.DeleteComment(srcFileName, 1, commentType)

      comment = codecs.ReadComment(srcFileName, 1, commentType)
      If (Not comment Is Nothing) Then
         Debug.WriteLine("comment is still there!")
      End If
   End If
   ' Clean up
   codecs.Dispose()
End Sub

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;

public void DeleteCommentExample()
{
   RasterCodecs codecs = new RasterCodecs();

   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Test.jpg");

   RasterCommentMetadataType commentType = RasterCommentMetadataType.IptcKeywords;
   RasterCommentMetadata comment = codecs.ReadComment(srcFileName, 1, commentType);
   if (comment == null)
      Debug.WriteLine("comment is already missing!");
   else
   {
      codecs.DeleteComment(srcFileName, 1, commentType);

      comment = codecs.ReadComment(srcFileName, 1, commentType);
      if (comment != null)
         Debug.WriteLine("comment is still there!");
   }

   // Clean up
   codecs.Dispose();
}

static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;

      
public async Task DeleteComment()
{
   RasterCodecs codecs = new RasterCodecs();
   string srcFileName = @"Assets\Test.jpg";
   StorageFile file = await Tools.AppInstallFolder.GetFileAsync(srcFileName);
   ILeadStream leadStream = LeadStreamFactory.Create(file);

   RasterCommentMetadataType commentType = RasterCommentMetadataType.IptcKeywords;

   RasterCommentMetadata comment = await codecs.ReadCommentAsync(leadStream, 1, commentType);
   if (comment == null)
      Debug.WriteLine("comment is already missing!");
   else
   {
      await codecs.DeleteCommentAsync(leadStream, 1, commentType);

      comment = await codecs.ReadCommentAsync(leadStream, 1, commentType);
      if (comment != null)
         Debug.WriteLine("comment is still there!");
   }

   // Clean up
   codecs.Dispose();
}
Requirements

Target Platforms

See Also

Reference

RasterCodecs Class
RasterCodecs Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.