Archived Forum Post

Index of archived forum posts

Question:

How to Create XMP like PhotoShop?

Mar 01 '13 at 11:39

I have two XMP files. One of them, createdByPhotoshop.xmp imports into Photoshop without an error. It is produced by Photoshop. The other, createdByChilkat.xmp produced by my app using Chilkat gets an error when imported into Photoshop. I notice that there is a "packet" element at the top of the createdByPhotoshop.xmp file that is not present in the createdByChilkat.xmp file.

For example, the createdByPhotoshop.xmp begins like this:

<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.1-c036 46.276720, Mon Feb 19 2007 22:13:43        ">

But the createdByChilkat.xmp begins like this:

<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/">

How can I make Chilkat create the same XMP as created by PhotoShop?


Answer

The Chilkat XMP API, which is strictly for managing XMP's in JPG and TIFF images and no other file formats, should be thought of as providing these bits of functionality:

1) The ability to access the XMP meta data contained within JPG and/or TIFF files.
2) The ability to add XMP meta data to JPG and/or TIFF files.
3) The ability to update XMP meta data ...
4) Methods for accessing and modifying the XML that comprises the XMP meta data.

It's important to understand that #4 is really just a set of methods that wrap the Chilkat XML API. The Chilkat XML object is always the 1st argument passed to any of the methods. For example:

public bool AddSimpleStr(Xml iXml, string propName, string propVal);

What this means is that you are free to manipulate the XMP's XML using the Chilkat XML API directly. It allows you "lower level" access to achieve anything that may be needed. In this case, it seems that adding the following attribute is required:

 x:xmptk="Adobe XMP Core 4.1-c036 46.276720, Mon Feb 19 2007 22:13:43        "

To do it, you could use the Chilkat XML API to navigate to the desired XML node and then call the Chilkat.Xml.AddAttribute method, passing "x:xmptk" for the tag and "Adobe XMP Core 4.1-c036 46.276720, Mon Feb 19 2007 22:13:43 " for the value.