Bug 507668 - Prioritize user-added metadata over the ones in MakerNotes.
Summary: Prioritize user-added metadata over the ones in MakerNotes.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Exif (other bugs)
Version First Reported In: 8.7.0
Platform: Appimage Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-30 16:38 UTC by pthfdr
Modified: 2025-07-31 20:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 8.8.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pthfdr 2025-07-30 16:38:00 UTC
SUMMARY
It seems that DigiKam uses the metadata in MakerNotes first, which can be wrong or generic when using a "dumb" or third-party lens. I can correct the metadata using `exiftool`, but DigiKam seems to not recognize the updated data.

STEPS TO REPRODUCE
1. Take a raw photo and convert it to DNG format using Adobe DNG converter.
2. Update metadata using `exiftool`.
3. Import the DNG files, and check the metadata in the "Table" view.

OBSERVED RESULT
The photos show the metadata in MakerNotes.

EXPECTED RESULT
The photos show the updated metadata set in EXIF and/or XMP.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian Sid
KDE Plasma Version: N/A
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.3

ADDITIONAL INFORMATION
2 examples are provided (too large for attachments): https://filebin.net/pq44k7s1ketgz8l1

`1.dng` is from a Sigma 8-16 lens on a Pentax K-70. There is a known issue with Pentax cameras that caused the camera to read any focal length less than 10mm as 0mm. The focal length is still saved in the `LensFocalLength` field, so I run `exiftool -tagsfromfile @ '-FocalLength<LensFocalLength' 1.dng` to change the focal length. After that, if using `exiftool` backend, the 35mm eqv. focal length is not shown and the lens name is missing (seems to be random among similar photos). If not using the `exiftool` backend, the 35mm eqv. focal length is still missing, but the lens name show properly.

`2.dng` is from a Tokina 80-400 lens, which `LensType` ID corresponds to "Sigma or Samsung lens". I used `exiftool -m -Lens="Tokina AT-X 80-400mm F4.5-5.6" -LensModel="Tokina AT-X 80-400mm F4.5-5.6" 2.dng` to manually update the lens name, but the MakerNote name (based on the `LensType` ID) is always used. This also affects "dumb" lens (which `LensType` ID would be "M-42 or No Lens" for the original K mount or "A Series Lens" for KA mount).

My suggestion is to use the EXIF and XMP data first, then the "composite" data (which should show the 35mm eqv. focal length), and use the MakerNote data last.
Comment 1 Maik Qualmann 2025-07-31 06:34:20 UTC
I don't see any errors in the 1.dng image; digiKam shows the focal length as 8.1mm. This matches all possible metadata fields, both Exif and the maker notes.

In the 2.dng image, we can prioritize Exif.Photo.LensModel first, just like with Sony and Canon, for Pentax.

Maik
Comment 2 Maik Qualmann 2025-07-31 06:48:14 UTC
Git commit 258d32593707e4d684e30fc1991ca991b0e8c80f by Maik Qualmann.
Committed on 31/07/2025 at 06:46.
Pushed by mqualmann into branch 'master'.

prioritize Exif.Photo.LensModel also for Ricoh/Pentax

M  +5    -1    core/libs/metadataengine/dmetadata/dmetadata_photo.cpp

https://invent.kde.org/graphics/digikam/-/commit/258d32593707e4d684e30fc1991ca991b0e8c80f
Comment 3 Maik Qualmann 2025-07-31 08:04:03 UTC
I don't see any problems with the focal length in the digiKam code. I suspect they have to reread the metadata from the image to the database if they subsequently changed the values with ExifTool.

Maik
Comment 4 pthfdr 2025-07-31 15:44:17 UTC
(In reply to Maik Qualmann from comment #3)
> I don't see any problems with the focal length in the digiKam code. I
> suspect they have to reread the metadata from the image to the database if
> they subsequently changed the values with ExifTool.
> 
> Maik

I have updated to 8.7.0, and the issue persists.

Refer to the 2 screenshots I have added to the filebin link. I went to Settings->Configure digikam->Metadata, and unchecked "Use `exiftool` backend to read metadata from files". After that, I selected all the files in the folder, and selected Item->Reread metadata from file. The 35mm eqv focal length is missing, despite it being shown correctly in the right. Then, I re-enabled the `exiftool` backend and reread the metadata again (which makes the lens name disappear at random).

Regarding the commit, as I have mentioned before, the behavior (read from XMP `Lens` and EXIF `LensModel`) should be the default and not limited to certain brands of cameras; the data from makernotes should be considered last (instead of first) and should only be used if not found anywhere else, as it is not uncommon to take photos using an adapted/"dumb" lens and fill in the missing metadata afterwards.
Comment 5 caulier.gilles 2025-07-31 15:58:26 UTC
No, you need to try with 8.8.0 appImage daily build available here:

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

Best regards

Gilles Caulier
Comment 6 pthfdr 2025-07-31 16:17:41 UTC
(In reply to caulier.gilles from comment #5)
> No, you need to try with 8.8.0 appImage daily build available here:
> 
> https://files.kde.org/digikam/
> 
> Best regards
> 
> Gilles Caulier

It seems that the edited lens names now show correctly. However the first issue shown in the screenshots still exists in the latest daily build.
Comment 7 Maik Qualmann 2025-07-31 18:23:16 UTC
The 35mm specification isn't a bug; you need to ensure that this information is also written to the corresponding Exif field so that Exiv2 can evaluate it.
The display in the ExifTool viewer is likely a dynamic calculation, which we cannot currently evaluate. You need to set the metadata field "Exif.Photo.FocalLengthIn35mmFilm" and/or "Xmp.exif.FocalLengthIn35mmFilm".

Maik
Comment 8 Maik Qualmann 2025-07-31 20:33:37 UTC
I checked again; there's no information about the 35mm focal length in image 1.dng. We already have a bug report regarding the calculation of the 35mm focal length, see Bug 367935
I'm therefore closing this bug now.

Maik