Bug 221460

Summary: Xmp subject tags imported in wrong order
Product: [Applications] digikam Reporter: Jakob Malm <jakob.malm>
Component: Metadata-XmpAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, schubert.seb
Priority: NOR    
Version: 1.0.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 7.3.0
Sentry Crash Report:
Attachments: JPEG with both Xmp.lr.hierarchicalSubject and Xmp.dc.subject
JPEG with only Xmp.dc.subject
JPEG with only Xmp.lr.hierarchicalSubject
jpg with HierarchicalSubject and "plain" subject
Screenshot showing the problem

Description Jakob Malm 2010-01-06 00:11:29 UTC
Version:           1.0.0 karmic-backports (using KDE 4.3.4)
OS:                Linux
Installed from:    Ubuntu Packages

I have a JPEG file with the following XMP tags, among others:

Xmp.lr.hierarchicalSubject                   XmpBag      1  Personer|Familj|Jonatan
Xmp.dc.subject                               XmpBag      3  Familj, Jonatan, Personer

When digiKam imports this photo it does not appear to read Xmp.lr.hierarchicalSubject, but instead Xmp.dc.subject. All tags (Familj, Jonatan, Personer) are checked in the keywords panel.

In DMetadata::getImageTagsPath (http://lxr.kde.org/source/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp#569), it appears that the intention is to read ONE of the following, in this order:
- Xmp.digikam.TagsList (not found in my JPEG)
- Xmp.lr.hierarchicalSubject (in my JPEG)
- Xmp.dc.subject (in my JPEG)
- Iptc.Application2.Keywords (also in my JPEG)

Is the Xmp.dc.subject read at some other place than in this function?

If I delete the Xmp.dc.subject tag, my hierarchical keywords are read correctly from Xmp.lr.hierarchicalSubject, and only Personer/Familj/Jonatan is checked in the keywords panel.
Comment 1 caulier.gilles 2010-01-06 09:51:11 UTC
No only this code is used to play with metadata. The proof : if you comment right line, it's work.

I suspect a bug in this code. Simple...

Gilles Caulier
Comment 2 caulier.gilles 2010-01-06 09:53:34 UTC
Can you attach a JPEG file to test on my computer ?

Gilles Caulier
Comment 3 Jakob Malm 2010-01-06 10:30:11 UTC
Created attachment 39605 [details]
JPEG with both Xmp.lr.hierarchicalSubject and Xmp.dc.subject
Comment 4 Jakob Malm 2010-01-06 10:31:14 UTC
Created attachment 39606 [details]
JPEG with only Xmp.dc.subject
Comment 5 Jakob Malm 2010-01-06 10:32:44 UTC
Created attachment 39607 [details]
JPEG with only Xmp.lr.hierarchicalSubject
Comment 6 Jakob Malm 2010-01-06 10:45:09 UTC
I feel a bit embarrassed now... (blush) These photos actually imported correctly. Could it be that I had not imported these photos before? With the photos I previously tested I did a lot of importing/deleting... Sorry, it doesn't quite make sense to me at the moment. I will see if I can make some more sense and post back.
Comment 7 caulier.gilles 2010-01-06 11:18:31 UTC
yes, perhaps, and it can be another problem.

To be sure, it's simple : create a new account in your computer and start digiKam to create an empty database. Now import your pictures...

The database file is digikam4.db. To re-test later in the same condition with this dummy user account, just remove this file and start again digiKam.

Gilles Caulier
Comment 8 caulier.gilles 2010-01-06 14:21:00 UTC
Sorry, i cannot reproduce the problem there with JPG image including Xmp.lr.hierarchicalSubject and Xmp.dc.subject. Importing to a new folder and LightRoom tag path is properly imported to digiKam database

Look my screenshots here :

http://farm3.static.flickr.com/2698/4250320461_e504a55063_o.png

http://farm5.static.flickr.com/4043/4250320541_5d7639d4d2_o.png

Gilles Caulier
Comment 9 Sebastian Schubert 2010-01-07 11:48:47 UTC
Created attachment 39646 [details]
jpg with HierarchicalSubject and "plain" subject

I have a similar problem. Tested with a clean (ie after removing digikamrc and database) configuration with 1.0_beta6. Attached is the problem jpg.
Comment 10 Sebastian Schubert 2010-01-07 11:49:34 UTC
Created attachment 39647 [details]
Screenshot showing the problem
Comment 11 caulier.gilles 2010-01-07 13:09:42 UTC
Sebastian,

Please update :

digiKam to 1.0.0 final
Exiv2 to 0.18.2 or 0.19
libkexiv2 to 1.0.0 (KDE 4.4 beta or checkout code from trunk, recompile and install)

Gilles Caulier
Comment 12 caulier.gilles 2010-01-07 13:25:03 UTC
I _LOVE_ Adobe, or ... BibblePro.

Look difference of XMP LightRoom tags from attached images :

[gilles@localhost BKO221460]$ exiv2 -px *.jpg |grep ierarchicalSubject

20100101-001328-01.jpg  Xmp.lr.HierarchicalSubject                   XmpSeq      2  Silvester|Feuerwerk, Level1|Level2|Level3

both.jpg              Xmp.lr.hierarchicalSubject                   XmpBag      1  Bottom|Middle|Top

First one is Sequence of string, tag name is HierarchicalSubject

Second one is a Bag of strings, tag name is hierarchicalSubject

Really a nice puzzle...

I love closed source software !

Gilles Caulier
Comment 13 caulier.gilles 2010-01-07 13:55:00 UTC
Fixed in my computer now :

digikam(2813)/digikam (core) Digikam::DImg::load: "/mnt/data/photo/test/BKO221460-1/20100101-001328-01.jpg"  : JPEG file identified           
digikam(2813)/digikam (core) Digikam::ImageScanner::addImage: Adding new item "/mnt/data/photo/test/BKO221460-1/20100101-001328-01.jpg"       
tagsPath:  ("Silvester|Feuerwerk", "Level1|Level2|Level3")                                                                                    
digikam(2813)/digikam (core) Digikam::DMetadata::getImageTagsPath: Tags Path imported from LR:  ("Silvester/Feuerwerk", "Level1/Level2/Level3")                                                                                                                                             
digikam(2813)/digikam (core) Digikam::DImg::load: "/mnt/data/photo/test/BKO221460-1/both.jpg"  : JPEG file identified                         
digikam(2813)/digikam (core) Digikam::ImageScanner::addImage: Adding new item "/mnt/data/photo/test/BKO221460-1/both.jpg"                     
tagsPath:  ("Bottom|Middle|Top")                                                                                                              
digikam(2813)/digikam (core) Digikam::DMetadata::getImageTagsPath: Tags Path imported from LR:  ("Bottom/Middle/Top") 

Gilles Caulier
Comment 14 caulier.gilles 2010-01-07 13:57:00 UTC
SVN commit 1071060 by cgilles:

LR xmp tags list can be hosted to both different way : XMPBag or XMPSeq
BUGS: 221460


 M  +5 -0      dmetadata.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1071060
Comment 15 Sebastian Schubert 2010-01-07 14:16:46 UTC
Thanks for the very fast fix!

Just FYI, apparently bibble guys consider their behaviour a bug:
http://support.bibblelabs.com/forums/viewtopic.php?f=67&t=15530
Comment 16 Jakob Malm 2010-01-07 14:26:48 UTC
Just to clarify:

The JPEGs I attached were CHANGED by me, in order for digiKam to read the tag. The output from Bibble 5 is (currently) to Xmp.lr.HierarchicalSubject XmpSeq.

Sebastian, I assume your JPEG was created by Bibble 5?
Comment 17 Jakob Malm 2010-01-07 14:32:19 UTC
(In reply to comment #15)
> Thanks for the very fast fix!

From me too!

> Just FYI, apparently bibble guys consider their behaviour a bug:
> http://support.bibblelabs.com/forums/viewtopic.php?f=67&t=15530

That was me... ;-)
Comment 18 Sebastian Schubert 2010-01-07 15:28:21 UTC
(In reply to comment #16)
> Sebastian, I assume your JPEG was created by Bibble 5?

Yup.
Comment 19 caulier.gilles 2010-01-07 15:51:04 UTC
Sebastian,

If i understand Bibble report,  Xmp.lr.hierarchicalSubject as an XMP Bag is the right way to use.

I ask this question because digiKam also export tags path in this tags for interoperability, and of course as a bag, not a sequence.

Gilles Caulier
Comment 20 Jakob Malm 2010-01-07 15:53:45 UTC
Gilles: My report at the Bibble forums was based on the current behaviour of digiKam, and NOT on any insight into Lightroom.
Comment 21 Jakob Malm 2010-01-07 22:21:30 UTC
I have now checked out latest version from svn, and I can confirm that digiKam now reads JPEGs created by Bibble, with hierarchical subject keywords preserved.

Thanks a lot Gilles! I will put a note about this on the Bibble forums too.
Comment 22 caulier.gilles 2021-04-07 18:36:03 UTC
Not reproducible with digiKam 7.3.0 + Exiv2 0.27.3