Bug 436345

Summary: Renamed FaceTags not written to file metadata
Product: [Applications] digikam Reporter: meku <kde.bugs>
Component: Metadata-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: metzpinguin
Priority: NOR    
Version First Reported In: 7.3.0   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 8.0.0
Sentry Crash Report:

Description meku 2021-04-29 10:00:16 UTC
SUMMARY
Some Face Tags have been renamed within Digikam and written to files, but the region fields in the XMP are not updated and continue to display the OLD face names.

The NEW names display correctly within Digikam: the Faces list, the Tags list, and the Face labels on the preview. 

The OLD names persist in the files in these XMP fields:
[XMP-mwg-rs]    RegionName
[XMP-MP]        RegionPersonDisplayName

In the IdentityAttributes table I can see that both the NEW and OLD names are here and they share the same id.

EXPECTED OUTCOME:
NEW names are written to XMP metadata, replacing OLD names.
Comment 1 Maik Qualmann 2021-04-29 10:32:16 UTC
We have discussed this problem before. Renaming tags (not just face tags) can affect a large number of images. The result would be a metadata writing job that could take a long time. Therefore, use the maintenance tool and limit the selection to the appropriate tags.

Maik
Comment 2 Maik Qualmann 2021-04-29 11:06:33 UTC
Where are you doing the renaming exactly? I can just see in the code that we write the metadata up to 100 affected images immediately or then ask the user.

Maik
Comment 3 Maik Qualmann 2021-04-29 11:11:05 UTC
A test here with the Windows version works as expected, the corresponding image metadata is written, including the names of the face regions. Renaming was done in the (people) tags tree.

Maik
Comment 4 Maik Qualmann 2021-04-29 11:18:44 UTC
I continue the self-talk ... Renaming in the Tags Manager does not write a face tag update.

Maik
Comment 5 meku 2021-04-29 11:39:11 UTC
This situation is the Face Tags have already been renamed and saved to files in a previous version of Digikam. It seems this step did not write the metadata well.

Now in the current Digikam there is no visibility of the OLD tags, they all display as the NEW tags. Yet in the file the XMP Region fields are still using the OLD tags.

Here is the issue I am trying to troubleshoot: writing the metadata to files in the current Digikam is still not updating or overwriting the tags in these XMP Region fields.
Comment 6 Maik Qualmann 2021-04-29 12:02:24 UTC
Via Menu-> Write Metadata to File, the face area metadata must also be updated. If that doesn't work, see if there are any error messages in the terminal / DebugView.

Maik
Comment 7 meku 2021-04-29 12:17:47 UTC
Via Menu->Item->Write Metadata to File.

In Digikam v7.2.0 there are no errors, the file is modified but the Region names are not changed.

In Digikam v7.3.0-20210428T170519 there are no errors, the file is modified bu the Region names are not changed. The console reports some messages:
Digikam::ExifToolParser::slotErrorOccurred: ExifTool process for action "Load Metadata" exited with error: QProcess::FailedToStart
Digikam::ExifToolProcess::kill: ExifToolProcess::kill(): shutdown ExifTool instance...
Digikam::ExifToolParser::Private::prepareProcess: ExifTool process cannot be started ( "././/bin" )
Comment 8 meku 2021-04-29 13:04:35 UTC
I found the OLD Face names were persisting in the database:

Tags table
id|pid|name    |icon|iconkde|
--|---|--------|----|-------|
19| 18|NEW Name|    |       |

TagProperties table:
tagid|property      |value   |
-----|--------------|--------|
   19|person        |OLD Name|
   19|faceEngineId  |OLD Name|
   19|faceEngineUuid|{uuid..}|

As suspected a previous Tag rename action in Digikam had left the database in what looks like an inconsistent state. It also appears Digikam is not able to repair or rectify this inconsistency via Metadata scanning or maintenance.

If I manually rename the OLD values in TagProperties then the correct Face Regions are now written to the file metadata.
Comment 9 caulier.gilles 2021-07-19 06:53:49 UTC
With next digiKam 7.4.0 release, AppImage bundle is compiled using a more recent Linux Mageia 7.1 host. Last stable Qt 5.15.2 and KF5 5.84 are used. ImageMagick codec 7 and libav 58 (ffmpeg) are used to supports extra image and video formats.

https://i.imgur.com/XV1tZkL.png

Please check if problem still reproducible with this version available as pre-release here:

https://files.kde.org/digikam/

Gilles Caulier
Comment 10 Maik Qualmann 2022-10-02 19:17:19 UTC
Renaming faces or tags now works fine in digiKam-8.0.0.

Maik