Copying lists of keywords from IFD0 tag to XMP tag

Started by Hugh, February 07, 2016, 10:33:22 AM

Previous topic - Next topic

Hugh

I have numerous photos where keywords are stored only in the IFD0 "XP Keywords" tag. I have started using an Android app (F-Stop) which only recognises XMP tags, so I need to copy the IDF0 tags into either the XMP-dc "Subject" or the XMP-microsoft "Last Keyword XMP" tag.

ExifTool reports the IDF0 keywords as being separated by semi-colons whereas the XMP keywords are shown as separated by commas. However, I think this oversimplifies the situation since I think the XMP keywords have to be stored as list items in an XML-like structure.

If I use the ExifTool command exiftool -k -sep ", " "-Subject<XPKeywords" "-xmp:Rating<Rating" %1"
the result looks like
<rdf:Description rdf:about=''
  xmlns:dc='http://purl.org/dc/elements/1.1/'>
  <dc:subject>
   <rdf:Bag>
    <rdf:li>Places of Interest/Museums;Works of Art/Pottery;Places/France/Paris/Guimet Museum</rdf:li>
   </rdf:Bag>
  </dc:subject>
</rdf:Description>


There is only one list item and F-Stop recognises this as one single long keyword.

How can I get the three keywords in this example recorded as separate list items in the Subject tag?

Phil Harvey

The problem is that XPKeywords is not a List-type tag, while XMP:Subject is.  You may use the -sep option to split a string into separate items when writing a list-type tag.  See FAQ 17 for more information.

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

Hugh

Thanks for your amazingly quick response.

I had already looked at FAQ 17, but I'm afraid I didn't understand it well enough to know how to apply it to my problem. As evidence of my confusion I tried adding -sep ", " to my command, thinking that I wanted to separate the items in the XMP:Subject tag by commas because that is the way they were shown in the ExifTool output. I now think that I should specify a semi-colon separator because that is what is used in the XPKeywords tag. Is that correct?

Will exiftool -k -sep ";" "-Subject<XPKeywords" "-xmp:Rating<Rating" %1 achieve what I want?

Phil Harvey

Correct.  You specify the separator to divide the XPKeywords string, and then they will stored separately when writing to any List-type tag.

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

Hugh

Thanks. I'll give it a go when I have time.

Thanks for all your efforts writing and supporting this program.

Hugh