Is there a way to read image tags from darktable from command-line, i.e. something like
darktable --get-tags myimage.jpg would return all tags of this image.
How can I tag an image or modify the tags from command-line such that the tags are integrated into the darktable database?
darktable seems to use xmp sidecar files and tags are in the xmp sidecar file like
<dc:subject> <rdf:Seq> <rdf:li>myTag1</rdf:li> <rdf:li>myTag2</rdf:li> </rdf:Seq> </dc:subject> <lr:hierarchicalSubject> <rdf:Seq> <rdf:li>myTag1</rdf:li> <rdf:li>myTag2</rdf:li> </rdf:Seq> </lr:hierarchicalSubject>
However I don't see how to read, set and modify it from commandline. My first thought was to use
awk but those are for things in one singe line.
Another approach would be to read and write directly to the darktable database, which is used additionally to the xmp files.
I just realized that
exiftool can set tags of xmp sidecar files: For example
exiftool -Subject=myNewTag myimage.jpg.xmp exiftool -`Hierarchical*Subject*`=myNewTag myimage.jpg.xmp
deletes all tags and sets
myNewTag as the only tag. Or
exiftool -Subject+=myAdditionalTag myimage.jpg.xmp exiftool -`Hierarchical*Subject*`+=myAdditionalTag myimage.jpg.xmp
adds the tag
myAdditionalTag to the list of tags.
Then I checked the option
look for updated xmp files on startup in darktable and hoped that it would update the tags while reload. However even if I deleted the old tags as in the first case, darktable shows me the newtag and the old (removed) tags.
So this doesn't seem the way to go.