Bug 514061

Summary: Metadata lost on face tag change
Product: [Applications] digikam Reporter: kde
Component: Metadata-XmpAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version First Reported In: 8.8.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In: 9.0.0
Sentry Crash Report:

Description kde 2026-01-01 23:31:52 UTC
SUMMARY
Existing tags (wrongfully) used by DigiKam as face tag are lost if the region is modified or removed.

STEPS TO REPRODUCE
1. Import files with tag [Sent To/Person/John Doe] and face tag [John Doe] from WLPG (actually DigiKam should assign the face tag to [Sent To/Person/John Doe] instead of creating a [People/John Doe] tag)
2. In DigiKam, open the picture in Preview Mode
3. Modify the face tag to instead use [People/John Doe]

OBSERVED RESULT
The tag [Sent To/Person/John Doe] previous present in
  - [EXIF::Windows Keywords]
  - [XMP::Subject]
  - [XMP::Last Keyword XMP]
is replaced with
  - [EXIF::Windows Keywords=John Doe]
  - [IPTC::Keywords=John Doe]
  - [XMP::Categories=<Categories><Category Assigned="0">People<Category Assignes="1">John Doe</Category></Category></Categories>] (which doesn't seem to be editable from Item/Edit Metadata...)
  - [XPM::Hierarchical Subject=People|John Doe],
  - [XMP::Tags List=People/John Doe]
  - [XMP::Subject=John Doe]
  - [XMP::Catalog Sets=People|John Doe]
  - [XMP::Last Keyword XMP=People/John Doe]

EXPECTED RESULT
  - Initial people tags discovery should always create People/Name OR ask for a default to use OR ask for each
  - Hierarchy shouldn't be lost in [EXIF::Windows Keywords], [XMP::Subject] and [XMP::Last Keyword XMP] (and probably anywhere)
  - Region names should not be also considered as standard tags unless explicitely defined as such
  - A non region tag should never be removed because a region tag is modified

SOFTWARE/OS VERSIONS
digiKam: 8.8.0
KDE Frameworks: 6.17.0
Qt: Using 6.9.1 and built against 6.9.1
Windows 11 Version 25H2
Build ABI: x86_64-little_endian-llp64
Kernel: winnt 10.0.26200

ADDITIONAL INFORMATION
- Obviously, the tags hierarchy doesn't have to be precisely this and is used as an example.
- In advanced search, there should be a way to search explicitly in specific EXIF, IPTC, XMP fields. In my specific use case, this would allow me to differentiate between (non broken) files which were really assigned to [Send to/<person>] and those for which it was wrongfully mapped to a face tag.
- In my current position, the only way I can think of to fix this is to open one by one over 10k pictures and
  1. look at the metadata to see if the tag is really present
  2. if it is, assign a new tag with a different name
  3. if a face tag with the same name is also present, retag it to the righ one in People
  4. Pray I don't do any error and that I didn't break too many already
(for personal reference: IMG_0610)
Comment 1 caulier.gilles 2026-01-02 05:22:36 UTC
Do you use XMP sidecar ? Exiv2 or ExifTool metadata backend ?
Comment 2 Maik Qualmann 2026-01-02 06:56:43 UTC
These metadata fields are initially presented without a hierarchy and, according to the metadata standard, should only contain individual keywords. If your other program has stored a path here, that's incorrect.

[EXIF::Windows Keywords]
[XMP::Subject]
[XMP::Last Keyword XMP]

Maik
Comment 3 Maik Qualmann 2026-01-02 07:06:40 UTC
Please note that faces stored in WLP do not have a path. digiKam will only assign the face to the People/ directory if it already exists there; otherwise, it will use the hierarchy found in the image.

Please provide a sample image.

Maik
Comment 4 kde 2026-01-02 18:23:08 UTC
(In reply to Maik Qualmann from comment #3)
> Please note that faces stored in WLP do not have a path. digiKam will only
> assign the face to the People/ directory if it already exists there;
> otherwise, it will use the hierarchy found in the image.
> 
> Please provide a sample image.
> 
> Maik

Though I read this before in the documentation, I still can't understand what it means. Clearly, on an initial scan, nothing exists in the People/* section but still, most of my face tags are there. Only a couple names were wrongly assigned to other locations. In all cases, modifying the face tag should not remove the standard tag from the image, at least, without asking first...

As for the sample image, do you have a location I could use to send it privately as it shows real people and that I couldn't post it publicly.

Finally, about your assessment that [EXIF::Windows Keywords] (behind the scene, XPKeywords) shouldn't contain hierarchy, let me argue that, as also highlighted for the WLP face regions tags, this tag is an EXIF extension by Microsoft so, I figure, the use Microsoft does of it should be truth doesn't it?
Comment 5 kde 2026-01-02 18:42:18 UTC
(In reply to caulier.gilles from comment #1)
> Do you use XMP sidecar ? Exiv2 or ExifTool metadata backend ?

Almost forgot. In that specific case, I was using ExifTool.
Comment 6 Maik Qualmann 2026-01-02 20:55:57 UTC
Git commit a2a66c07ec873ff5c64b9a44338db0bdc2397e12 by Maik Qualmann.
Committed on 02/01/2026 at 20:53.
Pushed by mqualmann into branch 'master'.

check/use an existing tag path for the face in the image
Related: bug 392008, bug 416213
FIXED-IN: 9.0.0

M  +2    -2    NEWS
M  +2    -0    core/libs/database/item/scanner/itemscanner_p.h
M  +24   -5    core/libs/database/item/scanner/itemscanner_photo.cpp

https://invent.kde.org/graphics/digikam/-/commit/a2a66c07ec873ff5c64b9a44338db0bdc2397e12
Comment 7 Maik Qualmann 2026-01-02 21:04:25 UTC
I'll test the behavior of Exif::XPKeywords tomorrow on a Windows machine.

Note that ExifTool itself no longer recommends using XPKeywords, partly due to the encoding in UCS2.

You can see my email address in the bug tracker if you log in, unless you reply via email (which you shouldn't).

Maik
Comment 8 Maik Qualmann 2026-01-03 20:29:22 UTC
Git commit d74734341cb855c15a8f639fbf2fafe786227c01 by Maik Qualmann.
Committed on 03/01/2026 at 20:28.
Pushed by mqualmann into branch 'master'.

Exif.Image.XPKeywords can be created as a tag path property
FIXED-IN: 9.0.0

M  +1    -1    NEWS
M  +33   -3    core/libs/metadataengine/dmetadata/dmetadata_tags.cpp
M  +1    -2    core/utilities/setup/metadata/namespaceeditdlg.cpp

https://invent.kde.org/graphics/digikam/-/commit/d74734341cb855c15a8f639fbf2fafe786227c01
Comment 9 Maik Qualmann 2026-01-03 20:37:22 UTC
It is now possible in the advanced digiKam metadata settings to disable the existing entry for Exif.Image.XPKeywords and create your own with the tag path property.

According to AI, Microsoft never used hierarchical tags in the Photo Editor. I can't find any examples of this online either. Even with the current Explorer, keywords are stored as individual strings, regardless of whether any separator is used.

You can now create Exif.Image.XPKeywords or Xmp.dc.Subject yourself so that digiKam can read and write tag paths.

Maik
Comment 10 kde 2026-01-08 06:15:15 UTC
(In reply to Maik Qualmann from comment #9)
> It is now possible in the advanced digiKam metadata settings to disable the
> existing entry for Exif.Image.XPKeywords and create your own with the tag
> path property.
> 
> According to AI, Microsoft never used hierarchical tags in the Photo Editor.
> I can't find any examples of this online either. Even with the current
> Explorer, keywords are stored as individual strings, regardless of whether
> any separator is used.
> 
> You can now create Exif.Image.XPKeywords or Xmp.dc.Subject yourself so that
> digiKam can read and write tag paths.
> 
> Maik

I juste sent to the sample pictures. And you are right that except for the the separator, no structure was present to mark this as hierarchical but still, it seems to be read as such by other softwares like DigiKam and Synology Photo Station since the hierarchy is correctly imported in both softwares.

This being said, how can I get myself out of this trap without having to go one by one over thousands of pictures and retag the person and make sure the original "Sent To/Person/John Doe" tag is maintained?