How to format the array of keywords in Xmp.dc.subject
Added by Andrew Toskin over 6 years ago
I'd like to add general tags / keywords to my images. Evix2's tag reference for Xmp.dc.subject describes the subject tag as an "unordered array of descriptive phrases or keywords."
I'd assumed this meant simply separating keywords and phrases with commas. For example, I have a line like this in most of my exiv2 commands files:
set Xmp.dc.subject XmpBag keyword, keyword, keyword...
However, image management software, such as Shotwell, and services such as Flickr, interpret my images as have having a single tag containing a very long string, instead of several short keywords. Is the "array" supposed to be wrapped in square brackets? Or should the keywords be delimited with something other than commas?
Thanks.
Replies (4)
RE: How to format the array of keywords in Xmp.dc.subject - Added by Alan Pater over 6 years ago
Well, specifying XmpBag is not needed, as that is the default type for Xmp.dc.subject.
I tested with the following command file:
set Xmp.dc.subject "tagA" set Xmp.dc.subject "tagB" set Xmp.dc.subject "tagC" set Xmp.dc.subject "tagD, tagE, tagF"
Ruuning the command:
exiv2 -m command.file testII.jpg
I could not reproduce the problem. Both Shotwell and Flickr have no problems recognizing and modifying the individual tags.
RE: How to format the array of keywords in Xmp.dc.subject - Added by Andrew Toskin over 6 years ago
What! I tried doing exactly as you did. I downloaded a random JPEG on the internet. I copied your exiv2 commands and ran it on the test image.
$ exiv2 -m command.file testII.jpg
terminal output:
File 1/1: testII.jpg
Set Xmp.dc.subject "tagA" (XmpBag)
Set Xmp.dc.subject "tagB" (XmpBag)
Set Xmp.dc.subject "tagC" (XmpBag)
Set Xmp.dc.subject "tagD, tagE, tagF" (XmpBag)
And then I uploaded the test image to Flickr. Tags A, B, and C are separate tags, but "tagD, tagE, tagF" is all one string. What am I doing wrong?
Adding keywords through the Iptc.Application2.Keywords property works the way it should, but I believe you have to write a separate `add Iptc.Application2.Keywords` line for each keyword, so it's a little tedious. And I think Xmp.dc.subject has a little broader support among image metadata parsers. (At least, Eye of Gnome doesn't recognize the IPTC keywords.)
I'm running exiv2 v0.24 on Ubuntu 15.04 x64.
Thanks.
RE: How to format the array of keywords in Xmp.dc.subject - Added by Alan Pater over 6 years ago
What am I doing wrong? Now I can't reproduce my previous result and get the same result as you.
So it seems the answer to your original query is that you need a separate line in the command file for each individual tag.
RE: How to format the array of keywords in Xmp.dc.subject - Added by Andrew Toskin over 6 years ago
Alan Pater wrote:
...you need a separate line in the command file for each individual tag.
It sure looks that way. I think calling the `Xmp.dc.subject` property an "array" of keywords is maybe a little misleading, then. The Exiv2 tag reference could use an extra sentence clarifying how it really works...
Anyway, thanks, Alan!