How to read and write Jpeg Metadata (IPTC and XMP) using Magick.NET?

Sep 2, 2013 at 5:43 PM

I am in need to read and write metadata (IPTC or XMP) from Jpeg images for my project. I am able to include Magick.NET into my C# project and able to retrieve Exif info using ExifProfile function. But I don't know which function to use to read/write IPTC/XMP info.

Any help will be much appreciated.

Sep 3, 2013 at 7:25 AM
Edited Sep 3, 2013 at 7:26 AM
With the GetProfile method you can retrieve the IPTC/XMP profile, and with the AddProfile method you can add a new profile.
using(MagickImage image = new MagickImage("input.jpg"))
  ImageProfile profile = image.GetProfile("IPTC");
  profile = ModifyProfile(profile);
Add this moment there are no classes for the XMP / IPTC profile but it might be a good idea to create them. You have to modify the byte array yourself. I will also see if I can change the ExifProfile class to enable modification of a values.

You do have to realize that you will loose some of the quality when you read and write a jpeg image.
Sep 3, 2013 at 10:39 AM
Thanks for the info.

Just to be clear, there are no properties or methods under ImageProfile object to retrieve IPTC info? Is there any information available on how to parse the ByteArray to retrieve individual IPTC field info?

Sorry for my ignorance and I am new to Magick.Net
Sep 3, 2013 at 10:57 AM
Edited Sep 3, 2013 at 10:57 AM
The only method to retrieve the IPTC info is the method ToByteArray. Once I figure out how to read the IPTC fields I will create an IptcProfile class.
Sep 22, 2013 at 8:12 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.