Metadata: Support for darktable's dc:subject #1341

Open
opened 2026-02-20 00:10:51 -05:00 by deekerman · 7 comments
Owner

Originally created by @maxammann on GitHub (Feb 27, 2022).

Is your feature request related to a problem? Please describe.

I just tagged my pictures in darktable and noticed that photoprism is not aware of them. Darktable uses the dc:subject for keywords/tags/labels: https://docs.darktable.org/usermanual/3.8/en/module-reference/utility-modules/shared/tagging/#editrename-tag

Describe the solution you'd like

Entries from the dc:subject could be added to the keywords or labels of photoprism.

Describe alternatives you've considered

An alternative would be to write a tool which extracts the darktable tags from the XMP files and converts them to a format photoprism already supports.

Additional context

I attached two xmp files.
XMPs.zip

Originally created by @maxammann on GitHub (Feb 27, 2022). **Is your feature request related to a problem? Please describe.** I just tagged my pictures in darktable and noticed that photoprism is not aware of them. Darktable uses the `dc:subject` for keywords/tags/labels: https://docs.darktable.org/usermanual/3.8/en/module-reference/utility-modules/shared/tagging/#editrename-tag **Describe the solution you'd like** Entries from the `dc:subject` could be added to the keywords or labels of photoprism. **Describe alternatives you've considered** An alternative would be to write a tool which extracts the darktable tags from the XMP files and converts them to a format photoprism already supports. **Additional context** I attached two xmp files. [XMPs.zip](https://github.com/photoprism/photoprism/files/8148550/XMPs.zip)
Author
Owner

@maxammann commented on GitHub (Feb 27, 2022):

It seems like exiftool already supports "Subject":

ExifTool Version Number         : 12.30
File Name                       : MAX_0297.NEF.xmp
Directory                       : .
File Size                       : 1393 bytes
File Modification Date/Time     : 2022:02:27 12:00:13+01:00
File Access Date/Time           : 2022:02:27 12:23:38+01:00
File Inode Change Date/Time     : 2022:02:27 12:00:15+01:00
File Permissions                : -r--------
File Type                       : XMP
File Type Extension             : xmp
MIME Type                       : application/rdf+xml
XMP Toolkit                     : XMP Core 4.4.0-Exiv2
Date/Time Original              : 2022:01:30 22:19:12
Rating                          : 0
Derived From                    : MAX_0297.NEF
Import timestamp                : 1645884581
Change timestamp                : -1
Export timestamp                : -1
Print timestamp                 : -1
Xmp version                     : 4
Raw params                      : 0
Auto presets applied            : 0
History end                     : 0
Iop order version               : 2
Masks history                   :
History                         :
Creator                         : Maximilian Ammann
Subject                         : funchal
Hierarchical Subject            : funchal
@maxammann commented on GitHub (Feb 27, 2022): It seems like exiftool already supports "Subject": ``` ExifTool Version Number : 12.30 File Name : MAX_0297.NEF.xmp Directory : . File Size : 1393 bytes File Modification Date/Time : 2022:02:27 12:00:13+01:00 File Access Date/Time : 2022:02:27 12:23:38+01:00 File Inode Change Date/Time : 2022:02:27 12:00:15+01:00 File Permissions : -r-------- File Type : XMP File Type Extension : xmp MIME Type : application/rdf+xml XMP Toolkit : XMP Core 4.4.0-Exiv2 Date/Time Original : 2022:01:30 22:19:12 Rating : 0 Derived From : MAX_0297.NEF Import timestamp : 1645884581 Change timestamp : -1 Export timestamp : -1 Print timestamp : -1 Xmp version : 4 Raw params : 0 Auto presets applied : 0 History end : 0 Iop order version : 2 Masks history : History : Creator : Maximilian Ammann Subject : funchal Hierarchical Subject : funchal ```
Author
Owner

@Faexa commented on GitHub (Mar 11, 2022):

Hello devs,
First of all, thank you very much for your product and your time. I'm in testing and it seems very promising for my use case.

I'm very confused by the differences between keywords (which are translated to labels by photoprism if set one time manualy) and Subject.

Anyway, for the darktable case cited before :
From what I've understood you use exiftool to read EXIF and embedded XMP tags in JPG whereas you parse XML for XMP files ?
(must be that since doing exiftool on an XMP file exiftool IMG_9775.CR2.xmp gives me a Subject entry whereas photoprism don't get it) EDIT: written in the FAQ...

To make it functional for XMP generated by darktable, in fact it's just a little thing to change :

In your FAQ here (https://docs.photoprism.app/user-guide/advanced/metadata/), you tell

PhotoPrism Exiftool Tag XMP Tag
Keywords Keywords RDF.Description.Subject.Seq.Li

In fact, Darktable (and from what I read digikam and maybe Lightroom?) uses RDF.Description.Subject.Bag.Li
See :

I think populating photoprism keywords should be from both RDF.Description.Subject.Seq.Li and RDF.Description.Subject.Bag.Li

(tried to rename manually my XMP file to dc:subjectrdf:Seq and it's working like a charm in photoprism)

Thank you very much for your very good work !

@Faexa commented on GitHub (Mar 11, 2022): Hello devs, First of all, thank you very much for your product and your time. I'm in testing and it seems very promising for my use case. I'm very confused by the differences between keywords (which are translated to labels by photoprism if set one time manualy) and Subject. Anyway, for the darktable case cited before : From what I've understood you use exiftool to read EXIF and embedded XMP tags in JPG whereas you parse XML for XMP files ? (must be that since doing exiftool on an XMP file `exiftool IMG_9775.CR2.xmp` gives me a Subject entry whereas photoprism don't get it) EDIT: written in the FAQ... To make it functional for XMP generated by darktable, in fact it's just a little thing to change : In your FAQ here (https://docs.photoprism.app/user-guide/advanced/metadata/), you tell PhotoPrism | Exiftool Tag | XMP Tag -- | -- | -- Keywords | Keywords | RDF.Description.Subject.Seq.Li In fact, Darktable (and from what I read digikam and maybe Lightroom?) uses `RDF.Description.Subject.Bag.Li` See : * https://github.com/darktable-org/darktable/issues/4095 * https://stackoverflow.com/questions/29001433/how-rdfbag-rdfseq-and-rdfalt-is-different-while-using-them#29012938 I think populating photoprism keywords should be from both `RDF.Description.Subject.Seq.Li` and `RDF.Description.Subject.Bag.Li` (tried to rename manually my XMP file to <dc:subject><rdf:Seq> and it's working like a charm in photoprism) Thank you very much for your very good work !
Author
Owner

@Faexa commented on GitHub (Mar 11, 2022):

To extend the discussion :

In case a field is populated with data from xmp, the data from xmp is the single source for this field. Meaning e.g keywords from > xmp overwrite other keywords coming from PhotoPrism such as colors or keywords derived from folder names.

Why that ? Can't we keep priority to XMP above Exif but anyway let photoprism add automatic keywords ?

As stated before I don't understand the difference bewteen Keyword and Subject, and the mixing done between the both

PhotoPrism Exiftool Tag XMP Tag
Keywords Keywords RDF.Description.Subject.Seq.Li
Subject Subject / PersonInImage / ObjectName / HierarchicalSubject / CatalogSets

For example:
I have a RAW file with a XMP file
-> I set Title, Author and tags (TAG1, TAG2) in darktable (-> XMP Subject.Bag)
If I index now, the photoprism keyword would be populated with TAG1, TAG2 and blocking any automatic tag added by photoprism ?

Pros: my tags populates photoprism keywords and can be labels automaticaly
Cons: loose ability to automatic tags / photoprism subject is not populated (since only read from exiftool)

-> On the other hand, let's say I export to JPG and I index only the JPG (without RAW and CR2)
Tags/Subject in XMP file is written in embedded XMP metadata
So as the previous array says: photoprism Subject is populated with Subject
But keyword is not populated so I can't have automatic labeling with my Subject tags

Proposition :
why not never populate the keyword field and keep it dynamic for photoprism operations ?

PhotoPrism Exiftool Tag XMP Tag
Keywords - -
Subject Subject / PersonInImage / ObjectName / HierarchicalSubject / CatalogSets / Keywords RDF.Description.Subject.Seq.Li / RDF.Description.Subject.Bag.Li

And populate keywords with the automatics label of photoprism AND Subjects.
This way we keep XMP precedence, if no XMP we get maximum of informations from embedded metadata AND we can add theses tags to the keywords list which is used to create photoprism labels

(However I probably lack the distinction between Keywords and Subjet)

@Faexa commented on GitHub (Mar 11, 2022): To extend the discussion : > In case a field is populated with data from xmp, the data from xmp is the single source for this field. Meaning e.g keywords from > xmp overwrite other keywords coming from PhotoPrism such as colors or keywords derived from folder names. Why that ? Can't we keep priority to XMP above Exif but anyway let photoprism add automatic keywords ? As stated before I don't understand the difference bewteen Keyword and Subject, and the mixing done between the both PhotoPrism | Exiftool Tag | XMP Tag -- | -- | -- Keywords | Keywords | RDF.Description.Subject.Seq.Li Subject | Subject / PersonInImage / ObjectName / HierarchicalSubject / CatalogSets For example: I have a RAW file with a XMP file -> I set Title, Author and tags (TAG1, TAG2) in darktable (-> XMP Subject.Bag) If I index now, the photoprism keyword would be populated with TAG1, TAG2 and blocking any automatic tag added by photoprism ? Pros: my tags populates photoprism keywords and can be labels automaticaly Cons: loose ability to automatic tags / photoprism subject is not populated (since only read from exiftool) -> On the other hand, let's say I export to JPG and I index only the JPG (without RAW and CR2) Tags/Subject in XMP file is written in embedded XMP metadata So as the previous array says: photoprism Subject is populated with Subject But keyword is not populated so I can't have automatic labeling with my Subject tags Proposition : why not never populate the keyword field and keep it dynamic for photoprism operations ? PhotoPrism | Exiftool Tag | XMP Tag -- | -- | -- Keywords | - | - Subject | Subject / PersonInImage / ObjectName / HierarchicalSubject / CatalogSets / Keywords | RDF.Description.Subject.Seq.Li / RDF.Description.Subject.Bag.Li And populate keywords with the automatics label of photoprism AND Subjects. This way we keep XMP precedence, if no XMP we get maximum of informations from embedded metadata AND we can add theses tags to the keywords list which is used to create photoprism labels (However I probably lack the distinction between Keywords and Subjet)
Author
Owner

@heitorPB commented on GitHub (Nov 8, 2023):

Could this be solved by extending Exif() at https://github.com/photoprism/photoprism/blob/preview/internal/meta/exif.go#L47 ?

Would something like this solve it?

	if value, ok := data.exif["dc.subject"]; ok {
		data.Labels.append(value)
	}
@heitorPB commented on GitHub (Nov 8, 2023): Could this be solved by extending `Exif()` at https://github.com/photoprism/photoprism/blob/preview/internal/meta/exif.go#L47 ? Would something like this solve it? ```go if value, ok := data.exif["dc.subject"]; ok { data.Labels.append(value) } ```
Author
Owner

@lastzero commented on GitHub (Nov 8, 2023):

DC stands for Dublin Core. It's optionally available with XMP, but not Exif.

@lastzero commented on GitHub (Nov 8, 2023): DC stands for Dublin Core. It's optionally available with XMP, but not Exif.
Author
Owner

@heitorPB commented on GitHub (Nov 8, 2023):

Oh, I didn't know the meaning of dc, thanks for that!

This is what I see from a jpg I exported from Darktable:

$ exiv2 -p a pr DSC_7035.jpg  | grep -i xmp.dc
Xmp.dc.creator                               XmpSeq      1  Heitor de Bittencourt
Xmp.dc.title                                 LangAlt     1  lang="x-default" House
Xmp.dc.description                           LangAlt     1  lang="x-default" A small house, in the trees.
Xmp.dc.rights                                LangAlt     1  lang="x-default" Creative Commons Attribution-NonCommercial-NoDerivs (CC BY-NC-ND)
Xmp.dc.subject                               XmpBag     47  Brazil, City, House, South America, Window, [etc]

The Xmp.dc fields are in the jpg metadata. Here are some of them (I probably didn't fill all options before exporting the photo):

$ exiv2 -p a pr DSC_7035.jpg | grep Xmp | cut -d " " -f 1
Xmp.exif.DateTimeOriginal
Xmp.exif.GPSVersionID
Xmp.exif.GPSLongitude
Xmp.exif.GPSLatitude
Xmp.exif.GPSAltitudeRef
Xmp.exif.GPSAltitude
Xmp.xmp.Rating
Xmp.xmpMM.DerivedFrom
Xmp.dc.creator
Xmp.dc.title
Xmp.dc.description
Xmp.dc.rights
Xmp.dc.subject
Xmp.lr.hierarchicalSubject

Does the Exif() function I linked above export all metadata that I can query via exiv2? Do you think this would be a way to get this information into Photoprism?

@heitorPB commented on GitHub (Nov 8, 2023): Oh, I didn't know the meaning of `dc`, thanks for that! This is what I see from a jpg I exported from Darktable: ```bash $ exiv2 -p a pr DSC_7035.jpg | grep -i xmp.dc Xmp.dc.creator XmpSeq 1 Heitor de Bittencourt Xmp.dc.title LangAlt 1 lang="x-default" House Xmp.dc.description LangAlt 1 lang="x-default" A small house, in the trees. Xmp.dc.rights LangAlt 1 lang="x-default" Creative Commons Attribution-NonCommercial-NoDerivs (CC BY-NC-ND) Xmp.dc.subject XmpBag 47 Brazil, City, House, South America, Window, [etc] ``` The `Xmp.dc` fields are in the jpg metadata. Here are some of them (I probably didn't fill all options before exporting the photo): ```bash $ exiv2 -p a pr DSC_7035.jpg | grep Xmp | cut -d " " -f 1 Xmp.exif.DateTimeOriginal Xmp.exif.GPSVersionID Xmp.exif.GPSLongitude Xmp.exif.GPSLatitude Xmp.exif.GPSAltitudeRef Xmp.exif.GPSAltitude Xmp.xmp.Rating Xmp.xmpMM.DerivedFrom Xmp.dc.creator Xmp.dc.title Xmp.dc.description Xmp.dc.rights Xmp.dc.subject Xmp.lr.hierarchicalSubject ``` Does the `Exif()` function I linked above export all metadata that I can query via `exiv2`? Do you think this would be a way to get this information into Photoprism?
Author
Owner

@lastzero commented on GitHub (Nov 9, 2023):

exiv2 / exiftool may both have "Exif" in their name, but this is XMP metadata not Exif. So our Exif() function won't extract that. For XMP support, see:

TLDR: What has kept us from doing more with XMP so far is proper XML support in Go, the programming language we use (besides, XMP is a pretty extensive meta metadata format, so each model requires extra work). Maybe there are better libraries out there now. Contributions welcome!

@lastzero commented on GitHub (Nov 9, 2023): exiv2 / exiftool may both have "Exif" in their name, but this is XMP metadata not Exif. So our `Exif()` function won't extract that. For XMP support, see: - https://docs.photoprism.app/developer-guide/metadata/xmp/ TLDR: What has kept us from doing more with XMP so far is proper XML support in Go, the programming language we use (besides, XMP is a pretty extensive meta metadata format, so each model requires extra work). Maybe there are better libraries out there now. Contributions welcome!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/photoprism#1341
No description provided.