Keywords in xml sidecar files

Started by jmwjmw, March 06, 2014, 02:02:49 PM

Previous topic - Next topic

jmwjmw

Hello: I am using xml sidecar files to import some metadata to images. Works great ... only issue I have run into is I can't figure out how to import keywords. I have tried <XMP-xmp:Keywords>mykeyword<\XMP-xmp:Keywords> and <XMP:Keywords>mykeyword<\XMP:Keywords>

Any suggestions would be greatly appreciated.

thanks

Phil Harvey

The standard location for keywords in XMP is XMP-dc:Subject.  This is a list-type tag, and in an ExifTool XML file it should look like this:

<?xml version='1.0' encoding='UTF-8'?>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about='a.jpg'
  xmlns:et='http://ns.exiftool.ca/1.0/' et:toolkit='Image::ExifTool 9.54'
  xmlns:XMP-dc='http://ns.exiftool.ca/XMP/XMP-dc/1.0/'>
<XMP-dc:Subject>
  <rdf:Bag>
   <rdf:li>one</rdf:li>
   <rdf:li>two</rdf:li>
  </rdf:Bag>
</XMP-dc:Subject>
</rdf:Description>
</rdf:RDF>


- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jmwjmw

Thank you very much for the quick reply.

If I wanted to mix in non-list tags (such as <XMP-iptcCore:Headline>myhead<\XMP-iptcCore:Headline><XMP-dc:Description>mydesc<\XMP-dc:Description>) where would the appropriate place be to put them in this xml? I would assume I would put the other dc tags above or below the Subject tag, but what about other XMP like XMP-iptcCore and XMP-photoshop. Would I just mimic the XMP-dc structure?

Thanks again

Phil Harvey

You can answer all your questions by using the -X option to export the tags you are wondering about.  If the tags don't exist, write them with dummy values as I did.  I used these commands to generate the output from my last post:

exiftool -xmp:subject=one -xmp:subject=two a.jpg
exiftool -xmp:subject -X a.jpg


Note that if you create tags in a different namespace, you will have to add a xmlns declaration for each one.  Again, see the -X output for details.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jmwjmw

Excellent! Thanks very much for your expertise ... and thanks for this wonderful tool.