Bug 214636

Summary: updating tag to XMP/IPTC bug
Product: [Applications] digikam Reporter: Olivier Becquaert <olivier.becquaert>
Component: Metadata-XmpAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahuggel, caulier.gilles, marcel.wiesweg, mul, olivier.becquaert
Priority: NOR    
Version: 1.0.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 7.3.0
Sentry Crash Report:
Attachments: Photo 1 before modification
Photo 2 berfore modification
Modification
Photo 1 after modification
Photo 1 after modification Caption/tag
Photo 2 after modification Caption/tag
Meta data options
photos enclosed

Description Olivier Becquaert 2009-11-15 12:59:34 UTC
Version:           1.0.0-beta5 (using KDE 4.3.2)
OS:                Linux
Installed from:    Ubuntu Packages

I have 2 photos : one with tags A and B (IPTC/keywords, XMP/Dubblin Core/Subject and XMP/Digikam Schema/TagList set from Caption/tags with Digikam), the other with tags A and C (same remark).

If I select my 2 photos and add a tag D (from Caption/Tags) my photos end with tags A and D (tag B has disapear from photo 1 and tag C has disapeared from photo 2 in IPTC/keywords, XMP/Subject+TagList, though the tags are still present/ticked in the Caption/Tag menu for each photo).

this problem was not present in Kubuntu 9.04 packages (2:0.10.0-1ubuntu3).

Hope this is clear enough...

Regards
Olivier
Comment 1 Olivier Becquaert 2009-11-15 15:21:08 UTC
Created attachment 38345 [details]
Photo 1 before modification
Comment 2 Olivier Becquaert 2009-11-15 16:08:17 UTC
Created attachment 38348 [details]
Photo 2 berfore modification
Comment 3 Olivier Becquaert 2009-11-15 16:10:21 UTC
Created attachment 38349 [details]
Modification
Comment 4 Olivier Becquaert 2009-11-15 16:10:54 UTC
Created attachment 38350 [details]
Photo 1 after modification
Comment 5 Olivier Becquaert 2009-11-15 16:11:16 UTC
Created attachment 38351 [details]
Photo 1 after modification Caption/tag
Comment 6 Olivier Becquaert 2009-11-15 16:11:50 UTC
Created attachment 38352 [details]
Photo 2 after modification Caption/tag
Comment 7 Olivier Becquaert 2009-11-15 16:13:16 UTC
No more "Anniversaire" tag
Comment 8 caulier.gilles 2009-11-17 22:23:00 UTC
Try with 1.0.0-beta6

Gilles Caulier
Comment 9 Olivier Becquaert 2009-11-17 22:35:01 UTC
(In reply to comment #8)
> Try with 1.0.0-beta6
> 
> Gilles Caulier

ok, I'll give it a try when it's in Kubuntu repos.

thanks for the answer.

regards
Olivier
Comment 10 Olivier Becquaert 2009-11-23 21:19:38 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > Try with 1.0.0-beta6
> > 
> > Gilles Caulier
> 
> ok, I'll give it a try when it's in Kubuntu repos.
> 
> thanks for the answer.
> 
> regards

I still have the same problem with beta6 (update from https://launchpad.net/~lure/+archive/ppa)

regards
Olivier
> Olivier
Comment 11 Marcel Wiesweg 2009-12-06 22:57:49 UTC
Cannot reproduce here, with arbitrarily chosen tags.
Can you reproduce when you start fresh: create three new tags; take an untouched image; add two of the tags; add the third tag?
What is your version of libkexiv2 and libexiv2? (Help->Component info)
Comment 12 Olivier Becquaert 2009-12-07 21:12:57 UTC
(In reply to comment #11)
> Cannot reproduce here, with arbitrarily chosen tags.
> Can you reproduce when you start fresh: create three new tags; take an
> untouched image; add two of the tags; add the third tag?
> What is your version of libkexiv2 and libexiv2? (Help->Component info)

Hello,
I am using above versions :
ii  exiv2                                0.18.2-1                                   EXIF/IPTC metadata manipulation tool
ii  libexiv2-5                           0.18.2-1                                   EXIF/IPTC metadata manipulation library
ii  libkexiv2-7                          4:4.3.2-0ubuntu1                           Qt like interface for the libexiv2 library (

I tried with new tags in current trees directories, with new tags directly created at root directory on digikam tag window and I still have the problem...

could it come from my option configuration (see attached picture) ?
shal I delete my tag database and recreate it from my pictures ?

regards
Comment 13 Olivier Becquaert 2009-12-07 22:22:36 UTC
Created attachment 38908 [details]
Meta data options

forgot to ass this in my previous comment.
Comment 14 Olivier Becquaert 2009-12-09 13:28:41 UTC
(In reply to comment #13)
> Created an attachment (id=38908) [details]
> Meta data options
> 
> forgot to ass this in my previous comment.

sorry please read "forgot to ADD this in my previous comment".
another piece of information : If I use "Sync Meta Data for all images" everything is then updated fine....but it takes a long time as it processes my whole database...

regards
Olivier
Comment 15 Marcel Wiesweg 2009-12-09 18:50:03 UTC
No dont delete your whole db ;-)
One thing to try is that you send me one picture - copied before changed - with which you could reproduce the problem.

You seem to have pretty up-to-date exiv2 versions, I assume your libkexiv2 is the one coming with KDE4.3.2. I am running latest trunk of course, there is a chance the problem was there and got fixed.

I am irritated that the batch operation succeeded.
What happens when you add a tag by drag-and-drop?
Comment 16 Olivier Becquaert 2009-12-09 20:16:51 UTC
Created attachment 38951 [details]
photos enclosed

Thank you for your quick answer.
I still have the problem if I drag and drop a tag...
find enclose sample pictures :
- photo 1 before modification : tag "Lyon"
- photo 2 before modification : tag "Cuisine"
selecting the two photos and add tag "Jardin" will end with 2 picture with only "Jardin" tag...

regards
Olivier
Comment 17 Marcel Wiesweg 2009-12-10 20:42:56 UTC
It seems that exiv2 is failing to write metadata to the image. When attempting to change a value from the command line I get the same errors as from digikam:

Warning: Directory Image, entry 0x0001 has unknown Exif (TIFF) type 0; setting type size 1.
Exiv2 exception in modify action for file /media/fotos/Digikam Sample/JPEG/BugTag-214636/Photo2-beforemodif-tagCuisine.JPG:
Input data does not contain a valid image
Comment 18 Olivier Becquaert 2009-12-10 21:02:34 UTC
cool so you managed to reproduce my problem....if I understand, it is a bug in exiv2, is this correct ?
or is it a problem with my pictures (and how I can correct it on my whole collection ?). The problem is also on any new image I download from my camera...

regards
Olivier
Comment 19 caulier.gilles 2009-12-10 22:33:53 UTC
yes, Exiv2 library. Andreas Huggel is there. he is Exiv2 author...

Gilles Caulier
Comment 20 Marcel Wiesweg 2009-12-20 15:46:00 UTC
Created Exiv2 ticket 663.

http://dev.exiv2.org/issues/show/663
Comment 21 Olivier Becquaert 2009-12-23 08:00:00 UTC
(In reply to comment #20)
One thing that I still don't understand : 
- setting tag and press "Apply" => metadata KO in photo, but digikam tag database OK
- using tool "Sync Meta Data for all images" => metada OK in photo, digikam tag database OK

what is the difference in term of command line behind syncing medata ?
Comment 22 Andreas Huggel 2009-12-23 09:16:48 UTC
Olivier, Marcel,

Please have a look at the discussion in the Exiv2 bug: http://dev.exiv2.org/issues/show/663

Two of the images provided with that bug report, Photo1-beforemodif-tagLyon.JPG and Photo2-beforemodif-tagCuisine.JPG, already have a weird JPEG structure.

We would like to understand what caused this, especially since it looks like digiKam/exiv2 may have played a role in the process.

The questions are: How were these two images processed after they were downloaded from the camera? What are the steps to reproduce such images?

Andreas
Comment 23 caulier.gilles 2009-12-23 09:22:11 UTC
Andreas,

With digiKam, the camera interface provide severals options to fix or adjust jpeg as date or orientation, and with new 1.0.0, apply metadata template for XMP to set autors and copyright. In all case, metadata are touched a little bits.

Gilles
Comment 24 caulier.gilles 2009-12-23 09:23:05 UTC
Andreas, 

Do you have installed digiKam 1.0.0 on your computer ?

Gilles Caulier
Comment 25 Andreas Huggel 2009-12-23 09:54:57 UTC
Gilles,

The pictures submitted with the Exiv2 bugreport don't just have somewhat illegal metadata.

They have a JPEG structure that doesn't make sense - each has two APP1 XMP segments and two (broken) APP13 Photoshop segments.

We need to find out what caused that.

Andreas
Comment 26 Andreas Huggel 2009-12-23 09:59:28 UTC
> Andreas, 
> 
> Do you have installed digiKam 1.0.0 on your computer ?
> 
> Gilles Caulier

I saw you released 1.0.0. Great work, congratulations to the entire team!
Once I manage to get Exiv2 0.19 out of the door, I will give it a try too.

Andreas
Comment 27 caulier.gilles 2009-12-23 10:02:00 UTC
Andreas,

Thanks (:=)))...

The only way where jpeg section are touched during download is, if i'm not to wrong, with the orientation adjustment option.

The code is based on transupp tool from libjpeg. Take a look there :

http://lxr.kde.org/source/extragear/graphics/digikam/libs/jpegutils/jpegutils.cpp#279

But, i'm suprized to see a bug here, because this tool exist since a long time now...

Gilles
Comment 28 Michael Ulbrich 2009-12-23 11:09:31 UTC
(In reply to comment #25)
 
> They have a JPEG structure that doesn't make sense - each has two APP1 XMP
> segments and two (broken) APP13 Photoshop segments.

Gilles, Andreas,

the "beforemodif" images from Olivier's attachment "photos enclosed" (38951) basically have the same metadata structure:

Photo1:

APP1  (XMP)
APP13 (IPTC)
APP13 (IPTC)
APP1  (XMP)

Photo2:

APP1  (XMP)
APP13 (IPTC) -> broken length -> parser get's out of sync
APP13 (IPTC)
APP1  (XMP)

Besides the duplication issue, structure and lengths are otherwise ok.

Probably a look at the individual Tags will provide some insight:

Photo1:
-------

APP1  (XMP)
 Software = digiKam-rc..-rc
 CreatorTool = digiKam-rc..-rc

APP13 (IPTC)
 Originating Program = digiKam
 Program Version = rc..-rc

APP13 (IPTC)
 Originating Program = digiKam
 Program Version = rc..-rc
 Keywords = Lyon

APP1  (XMP)
 Software = digiKam-rc..-rc
 Orientation = 1
 ImageWidth = 1704
 ImageHeight = 2272
 CreatorTool = digiKam-1.0.0-beta6
 ExifImageWidth = 1704
 ExifImageHeight = 2272
 TagsList = Lieu/Rh..ne-Alpes/Lyon
 HierarchicalSubject = Lieu|Rh..ne-Alpes|Lyon
 Subject = Lyon

Photo2:
-------

APP1  (XMP)
 Software = digiKam-rc..-rc
 CreatorTool = digiKam-rc..-rc
 TagsList = Themes/Cuisine
 HierarchicalSubject = Themes|Cuisine
 Subject = Cuisine

APP13 (IPTC)
 OriginatingProgram = digiKam
 ProgramVersion = rc..-rc
 Keywords = Cuisine       -> broken length points after this tag
 Keywords = Lyon
 Keywords = Cuisine

APP13 (IPTC)
 OriginatingProgram = digiKam
 ProgramVersion = rc..-rc
 Keywords = Lyon
 Keywords = Cuisine

APP1  (XMP)
 Software = digiKam-rc..-rc
 CreatorTool = digiKam-1.0.0-beta6
 TagsList = Lieu/Rh..ne-Alpes/Lyon/MaisonLyon
 TagsList = Themes/Cuisine
 HierarchicalSubject = Lieu|Rh..ne-Alpes|Lyon|MaisonLyon
 HierarchicalSubject = Themes|Cuisine
 Subject = MaisonLyon
 Subject = Cuisine

There is a certain correspondence between first XMP and first IPTC. Likewise for the second pair. So the each pair seem to be written in the same context. But why at all the duplication? Could it be that metadata of the same image is opened by individual program modules and saved twice?

Just curious ... Michael Ulbrich
Comment 29 Olivier Becquaert 2009-12-31 18:53:29 UTC
Hi,

I have tried with another camera and the problem still exist...with portrait or landscape pictures...
so it is not camera dependant or orientation dependant.

regards
Olivier
Comment 30 caulier.gilles 2021-04-25 08:42:34 UTC
Olivier,

Are you able to reproduce this problem with recent digiKam 7.x version and Exiv2 0.27.x ?

Gilles Caulier
Comment 31 Olivier Becquaert 2021-04-25 16:28:15 UTC
(In reply to caulier.gilles from comment #30)
> Olivier,
> 
> Are you able to reproduce this problem with recent digiKam 7.x version and
> Exiv2 0.27.x ?
> 
> Gilles Caulier

Hello Gilles,
Good news is 12 years later I still use Digikam :-).
The bug is gone, you can close it.
thank you for this great software !
Olivier (happy Digikam user since at least 12 years)
Comment 32 caulier.gilles 2021-04-25 16:56:30 UTC
Thanks Olivier.

Your feedback is very important as the UPSTREAM bug from Exiv2 project is done due to migration to github.

Again, we are happy to see you a long time digiKam user.

My best

Gilles Cauier