Bug 221918

Summary: Wrong thumbnails after save as
Product: [Applications] digikam Reporter: Julien Narboux <Julien>
Component: Thumbs-ImageAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, marcel.wiesweg
Priority: NOR    
Version: 1.1.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 1.2.0
Sentry Crash Report:
Attachments: Snapshot which shows that the thumbnail is the wrong one

Description Julien Narboux 2010-01-09 14:50:58 UTC
Version:           1.1.0 rev 1055453 (using KDE 4.3.2)
OS:                Linux
Installed from:    Ubuntu Packages

Using 1.1.0 rev 1055453.

When using save as the thumbnail of the saved picture is the orginal thumbnail instead of the edited version of the picture. 

Step to reproduce:
- open a jpeg file "toto.jpg" in the editor
- convert it to black and white (it should behave the same way for other filter I think but it is easier to see the bug with a modification which is obvious)
- save as a new file (png or jpeg) ("toto2.jpg")
- close the editor

-> The thumbnail of toto2 is the thumbnail of the original toto.jpg instead of the black and white picture.

Julien
Comment 1 Julien Narboux 2010-01-09 14:53:55 UTC
Created attachment 39711 [details]
Snapshot which shows that the thumbnail is the wrong one
Comment 2 Marcel Wiesweg 2010-01-09 21:30:02 UTC
I could indeed reproduce that in one out of four attempts.
Comment 3 Marcel Wiesweg 2010-01-09 22:07:52 UTC
One important question: Is the thumbnail still wrong after a restart of digikam?
Comment 4 Julien Narboux 2010-01-09 22:36:23 UTC
Marcel,

Good guess ! the thumbnail is the right one after a restart of Digikam. 

I also noticed that I used save as png file and whereas I had enabled sort by file type view, the new picture has been added in the JPG section instead of png section of the thumbnail view. After a restart this was fixed as well.

Julien
Comment 5 Marcel Wiesweg 2010-01-23 21:33:06 UTC
No good idea currently.
I plan to rewrite the thumbbar with model/view for 1.2. I will revisit this bug then.
Comment 6 Julien Narboux 2010-01-25 08:52:39 UTC
Marcel,

I do not think this is related to thumbar. The wrong thumbnails also appear in the 'normal' view.

Julien
Comment 7 Marcel Wiesweg 2010-02-22 22:03:49 UTC
I have incidentally found the problem here: We use ImageInfo.copyItem, which is meant for a simple copy. It also copies the unique hash, so the thumbnail for the original image is used. After a collection scan (restart) this is corrected.

I need to fix that by removing usage of copyItem and instead more selectively copy the needed fields.
Comment 8 Marcel Wiesweg 2010-02-27 15:36:07 UTC
SVN commit 1096751 by mwiesweg:

Add methods to copy all appropriate properties from source to derived image.
Every copied field is explicitly selected.
This differs from copyItem, which just copies everything and should not be used.

CCBUG: 221918

 M  +25 -12    collectionscanner.cpp  
 M  +12 -4     collectionscanner.h  
 M  +34 -0     imagescanner.cpp  
 M  +10 -0     imagescanner.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1096751
Comment 9 Marcel Wiesweg 2010-02-27 15:36:30 UTC
SVN commit 1096752 by mwiesweg:

Add a method to ScanController that scans an image directly
and then copies the relevant attributes of another image to it.
When creating a new image in the image editor use this functionality.

BUG: 221918

 M  +2 -1      NEWS  
 M  +14 -0     digikam/scancontroller.cpp  
 M  +6 -0      digikam/scancontroller.h  
 M  +3 -1      utilities/imageeditor/editor/imagewindow.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1096752