Darktable's XMP, XSD?

I am going to be adding tags to my image viewer, and wanted to follow darktable’s XMP convention. I will also store the info in the image viewer’s database of course, but I also want it to be portable, and sidecar files seem like the best option.

With this context, does anyone know if an XSD exists for the XMP darktable uses, or even better, if there is a conventional, portable way to add tags and rating to an XMP, which is supported by all software which reads and writes the format?

I searched around and it all seems to be a bit arcane. There are the official Adobe specs, but being XML, one would thing a XSD would be available to facilitate development?

hello. hopefully i can help with this.

There is an xml element and attribute for both tags and ratings.

For ratings, it is:
<rdf:Description xmp:Rating="0">

You put the rating in the attribute values of xmp:Rating.

For tags, it is:

   <dc:subject>
    <rdf:Bag>
     <rdf:li>changed</rdf:li>
     <rdf:li>darktable</rdf:li>
     <rdf:li>format</rdf:li>
     <rdf:li>nef</rdf:li>
    </rdf:Bag>
   </dc:subject>
   <lr:hierarchicalSubject>
    <rdf:Bag>
     <rdf:li>darktable|changed</rdf:li>
     <rdf:li>darktable|format|nef</rdf:li>
    </rdf:Bag>
   </lr:hierarchicalSubject>

Hierarchical tags are seperated by a pipe |. Single tags are in <rdf:li> elements. You need this whole structure.

You can find XML schema for the dublin core standard (the stuff you want) at DCMI: XML schemas to support the Guidelines for implementing Dublin Core™ in XML

Let me know if you have more questions.

2 Likes

Hey, thank you so much, this is exactly what I was looking for. That site with the spec looks great too. I will just target those elements you mention, seems like the easiest path for now and already covers a lot of ground

Sweet. Do ask if you have more questions.

Also note that color lables are not standard metadata. dt has its own thing, so does LR, etc etc.

2 Likes

While it would be an extra dependency, you might want to look at using exiv2 or ExifTool for this. Would potentially save you a lot of headaches.

I already have exiftool as an optional dependency, I had no idea it could deal with XMP, thanks, I’ll take a look at it

1 Like