Created attachment 135275 [details]
No error message is displayed when XMP is failed to be read from image file. XMP
STEPS TO REPRODUCE
1. Open and example files to Digikam album contained in WPG_XMP.zip
2. Making sure all XMP tags are enabled in Settings | Configure digikam | Metadata | XMP, click on "Reread metadata from File"
3. Click on files and view XMP metadata in the Metadata tab (located on the tab on the right and selecting XMP)
- For Readable_XMP.jpg - data is displayed on XMP Metadata tab.
- For Unreadable_XMP.jpg - no data is displayed on XMP Metadata tab, XMP data view is blank. The file contains XMP metadata.
- For cases where there is an error reading metadata, notify/warn user with an error message displayed in the pane. Example: "Invalid XMP data was found in file".
Windows: Windows 10
- In this particular case, the issue pertains to how the XMP was written. In a sense, it is valid XMP but it is very convoluted. The issue is described in the exiv2 issue reported here - https://dev.exiv2.org/issues/0001284
- As described in the bug, at one point it would lead to a crash of Digikam.
- The issue is quite annoying for users of the now un-supported Windows Photo Gallery. Exiftool is able to read the xmp. A way to correct the convoluted XMP by having it being re-constructed using the exiftool command:
exiftool Unreadable_XMP.jpg -xmp:all= -tagsfromfile @ -xmp:all
- I do not expect that Digikam correct the convoluted XMP. Should indicate that there is a problem reading the data and an alternative is to have it overwritten.
- Exiv2 returns "Error: XMP Toolkit error 101: Schema namespace URI and prefix mismatch".
There is no relapse from XMP sidecar to image metadata. The XMP sidecar metadata is always mixed with the image metadata. The XMP sidecars have a higher priority. A tag that is present in the image but not in the XMP is then not imported, etc. This behavior has proven itself over many years.
Oh, it's about the XMP files in the image. I don't think we will flood a window or the the system message bar for every error message that Exiv2 displays. That would be too much messages.
Adding for reference (may be of help to someone) a link to a forum post from the Exiftool Forums in which a method for detecting image files with such a condition and for correcting them.
Created attachment 146120 [details]
Seems Digikam can detect this condition when reading metadata from file (ref attached log):
 digikam.metaengine: Exiv2 ( 3 ) : XMP Toolkit error 101: Schema namespace URI and prefix mismatch
 digikam.metaengine: Exiv2 ( 2 ) : Failed to decode XMP metadata.
Exiftool can read the XMP ok. Could Exiftool be used instead to obtain the main XMP values which Digikam uses such as captions, tags, and face regions?
One should understand that the Adobe XMP SDK reports this error and cannot decode the XMP metadata. So the metadata is definitely defective or created incorrectly. The ExifTool can read it is because it has its own parser for the metadata that ignores errors. However, you will have problems with the image in most programs, since they use the Adobe XMP SDK.
Yes, of course ExifTool can be used as well, and it's planed for specific tasks.
Look the grouped bug entries from Metadata-ExifTool component:
Git commit 802d92a3ec46e2ca1b60aa0e2e9bdb8516d4f041 by Maik Qualmann.
Committed on 24/04/2022 at 14:58.
Pushed by mqualmann into branch 'master'.
add read Exiv2 warnings and errors
to then read the metadata with ExifTool
Related: bug 452567, bug 450117, bug 446363, bug 449637
M +6 -0 core/libs/metadataengine/engine/metaengine_fileio.cpp
M +8 -0 core/libs/metadataengine/engine/metaengine_p.cpp
M +1 -0 core/libs/metadataengine/engine/metaengine_p.h
The test files work fine in digiKam-8.0.0, when an error or warning occurs in Exiv2, ExifTool is automatically used to read the metadata.