Bug 339227 - Existing tags from image metadata are removed when adding new tags to multiple images
Summary: Existing tags from image metadata are removed when adding new tags to multipl...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Tags-Engine (show other bugs)
Version: 4.3.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-20 11:08 UTC by Paul
Modified: 2014-10-07 07:30 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.4.0


Attachments
Correct tags in dk database (151.89 KB, image/png)
2014-09-26 13:37 UTC, Paul
Details
Missing image meta-data (290.06 KB, image/png)
2014-09-26 13:38 UTC, Paul
Details
Image metadata after executing 'Image - Write Metadata to Image' (295.99 KB, image/png)
2014-09-26 14:26 UTC, Paul
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul 2014-09-20 11:08:52 UTC
When adding additional tags to multiple existing images, any tags that already exist are removed from thos images.

To reproduce:
1. Select existing images which have tags (for example 'A', 'B', and 'C').
2. Add new tags (for example '1' and '2').

Result:
The image (tag) metadata now only has tags 1 and 2. (Previous tags A, B, and C have been removed).

Expected result:
Image tag metadata correctly shows all tags.


This only affects the actual image metadata, the dk database correctly shows the tags. 
If only one image is updated with additional tags the image tag metadata is correctly written.

At the moment to ensure all tags are correctly written it is necessary to explicitly tell digiKam to 'Image, Write Metadata To Image'.

Possible regression, as this seems very similar to https://bugs.kde.org/show_bug.cgi?id=264745
Comment 1 caulier.gilles 2014-09-20 17:31:17 UTC
Veaceslav,

As expected, this entry have been created (:=)))...

Gilles
Comment 2 Veaceslav Munteanu 2014-09-26 12:02:47 UTC
So I made a scenario:

1st picture tag "A";
2nd picture tags "A", "B"
3rd picture tag "B"

after adding one tag to all 3 images above, I have all tags correctly written to metadata.

Gilles, can you reproduce this?
Comment 3 Paul 2014-09-26 13:36:36 UTC
@ Veaceslav

I've just tried your simple scenario, and that indeed worked as expected, odd...

With a 'real world' case this is the result, shown in the attached screen-shots.

The image initially had all of the tags shown in the tool-tip apart from 'Pending Print', this tag was added to this (and the other) test images.  All tags, both existing and newly added are correctly shown by digiKam.

The actual meta-data written to the image is shown in the second screen-shot, the only tag present is the one just added, all existing tags have been removed.
Comment 4 Paul 2014-09-26 13:37:33 UTC
Created attachment 88846 [details]
Correct tags in dk database
Comment 5 Paul 2014-09-26 13:38:11 UTC
Created attachment 88848 [details]
Missing image meta-data
Comment 6 caulier.gilles 2014-09-26 14:18:32 UTC
To respond about comment  #2, yes i work as expected in this case for me.

Gilles
Comment 7 Paul 2014-09-26 14:26:02 UTC
@ Veaceslav

As an afterthought, this is the meta-data after executing 'Image - Write Metadata to Image' from within digikam.

If you want the test images I'm using I can put them on dropbox...
Comment 8 Paul 2014-09-26 14:26:45 UTC
Created attachment 88849 [details]
Image metadata after executing 'Image - Write Metadata to Image'
Comment 9 Jeff Dooley 2014-09-28 00:21:01 UTC
Test case was performed using Digikam 3.5.0 on Kubuntu 14.04, and Bug was not reproduced. Correct writing of tags was observed.
Comment 10 meku 2014-10-01 07:33:52 UTC
I have found a method to reproduce bug, running on Xubuntu with Digikam 4.3.0

Example setup with 2 files and 3 tags:
Image1, tags "A", "B"
Image2, tags "A", "C"

Select BOTH images in the thumbnail view. 
Open the tags tab on the right. 
(Optionally enable "Tags already assigned" for clarity)

Tags "A", "B", "C" will display, however only "A" will be ticked.
Now if you make any changes TO THE SELECTED IMAGES and Apply, the database will be correct but only the COMMON tags will be written to the selected files.

Such that if you add tag "D", the thumbnail view will show
Image1, tags "A", "B", "D"
Image2, tags "A", "C", "D"
But the files metadata will be written as:
Image1, tags "A", "D"
Image2, tags "A", "D"
Comment 11 Paul 2014-10-01 10:06:18 UTC
This is quite an important issue, as there is potential for the loss of tags if one assumes that they have been correctly written to the image meta-data...

@ meku
Thanks for confirming this :)
Comment 12 Veaceslav Munteanu 2014-10-01 15:38:53 UTC
Ok, now I can reproduce... I used to assign tags from right-click Add Tags and it worked flawless but if you use left sidebar and apply button, it doesn't work....

Investigating...
Comment 13 Veaceslav Munteanu 2014-10-04 21:51:25 UTC
Git commit 068f5924f08ba45fb9b1c4dff907eba186b9ff5f by Veaceslav Munteanu.
Committed on 04/10/2014 at 21:47.
Pushed by munteanu into branch 'master'.

M  +1    -0    app/fileaction/databaseworkeriface.cpp
M  +1    -3    app/fileaction/fileworkeriface.cpp
M  +36   -0    app/fileaction/metadatahub.cpp
M  +13   -0    app/fileaction/metadatahub.h

http://commits.kde.org/digikam/068f5924f08ba45fb9b1c4dff907eba186b9ff5f
Comment 14 Veaceslav Munteanu 2014-10-04 21:52:35 UTC
Whew... just in time.. one day before 4.4 release ^_^
Comment 15 Paul 2014-10-05 07:50:32 UTC
Thanks! Appreciate the work you guys do. :)
Comment 16 caulier.gilles 2014-10-05 07:54:16 UTC
Paul,

If you can test using git/master implementation including last patch from Veaceslav, it will be fine. It's always good to have different people testing a solution before a release.

I will test on my computer now.

Gilles Caulier
Comment 17 caulier.gilles 2014-10-05 08:11:34 UTC
I just tried with a set of 3 images selected at the same time, including already tags and other labels properties.

I played to remove/add/changes digiKam properties in multiple conditions (1/2/3 images selected at the same time) to process change. In metadata (XMP digiKam namespace), all Tags are properly reflected the database content.

Did i miss some test conditions here ?

Gilles Caulier
Comment 18 Veaceslav Munteanu 2014-10-05 09:05:20 UTC
The main problem was disjoint tags not being applied when Apply button from left sidebar was pressed.

Adding tags with the context menu worked fine.
Comment 19 caulier.gilles 2014-10-05 09:12:49 UTC
Vesaceslav,

yes, i take a care to not use context menu and only perform changes through right sidebar and Apply button.

I also tested this report :

https://bugs.kde.org/show_bug.cgi?id=259228

and it sound not reproducible here...

Gilles
Comment 20 Veaceslav Munteanu 2014-10-05 09:16:13 UTC
DO not close 259228, it's still do not work for me....
Comment 21 caulier.gilles 2014-10-05 09:23:13 UTC
Veaceslav,

Do you think that file https://bugs.kde.org/show_bug.cgi?id=204487...

Can be fixed more easily since you change disjoint rules in MetadataHub.

Gilles
Comment 22 Paul 2014-10-05 10:47:59 UTC
(In reply to Gilles Caulier from comment #16)
> If you can test using git/master implementation including last patch from
> Veaceslav, it will be fine. It's always good to have different people
> testing a solution before a release.

Gilles,

Would like to help with testing this... but until 4.4.0 makes it into the openSuse repo won't be able to, sorry.  I need to learn how to build digiKam myself :)
Comment 23 caulier.gilles 2014-10-05 11:55:02 UTC
Paul,

It's explained here :

https://www.digikam.org/download/GIT

Gilles Caulier
Comment 24 Paul 2014-10-07 07:30:53 UTC
(In reply to Gilles Caulier from comment #23)
> It's explained here :

Gilles,

Apologies for taking so long... :)

I'm able to confirm that Vesaceslav's fix has solved the original problem.  I also spent some time generally changing quite a few tags and all were written correctly to the meta-data.

Thanks to you both.