Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, June 1, 2017 4:10:26 PM(UTC)
Nick Villalobos

Groups: Registered
Posts: 119

Was thanked: 4 time(s) in 4 post(s)

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.

Below is the code that you would need to add file metadata comments to a .JP2 image.
Code:

RasterCodecs codecs = new RasterCodecs();
RasterImage image = codecs.Load(input);

RasterCommentMetadata jp2comment = new RasterCommentMetadata();

// set the comment 
jp2comment.Type = RasterCommentMetadataType.Jpeg2000Latin;
jp2comment.FromAscii("This is a test string to load metadata to a JP2 image");
image.Comments.Add(jp2comment);

codecs.Options.Save.Comments = true;
codecs.Save(image, dest, RasterImageFormat.Jp2, 0);

// load the comment together with the image 
RasterCommentMetadata comment = codecs.ReadComment(dest, 1, RasterCommentMetadataType.Jpeg2000Latin);

Console.WriteLine("Comment of type " + comment.Type.ToString() + " = " + comment.ToAscii());            



Here is a screenshot of the outcome from the code above:
UserPostedImage
Nick Villalobos
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.038 seconds.