Bug 282903

Summary: Image corrupted after writing metadata due to sidecar XMP
Product: [Applications] digikam Reporter: Michal Thoma <michal>
Component: Metadata-SidecarAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahuggel, caulier.gilles
Priority: NOR    
Version: 2.1.1   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 2.6.0

Description Michal Thoma 2011-09-27 12:33:52 UTC
Version:           2.1.1 (using KDE 4.6.2) 
OS:                Linux

I have a RAW (PEF) file with accompanied XMP, created by digikam 2.0 before - I stopped writing metadata to XMP and reverted to writing metadata to image directly. I still want to Read Metadata from XMP so I also have ticked this.

Now when I change metadata like rating in any Image which has accompanied XMP, file get corrupted after that.

When the option Read Metadata from XMP is not selected, corruption will not happen.

Reproducible: Always

Steps to Reproduce:
1. In Preferences Metadata tab choose Write Metadata to XMP sicar only. 
2. Change Rating or other metadata of the image.
3. In Prefernces Metadata tab choose Write Metadata to image files only. Also tick Read Metadata from XMP option.
4. Change some image metadata then.



Actual Results:  
Image is corrupted and can't be viewed in digikam or other app.

Expected Results:  
Image metadata will be changed and data which were in XMP will be appended or used without corrupting the image.

Sample files (original image with xmp and corrupted image) are for download here:

http://download.thoma.cz/digikam-xmp-corruption.zip
Comment 1 Marcel Wiesweg 2011-10-29 15:08:01 UTC
What is your exiv2 and libkexiv2 version? Go to Help/Components for this info.
Comment 2 Marcel Wiesweg 2011-10-29 15:10:58 UTC
It seems the corrupted image contains only the metadata from the sidecar, the original image's metadata seems to be lost. I believe there are quite a few related bugs.
Nonetheless, I dont know why the image cannot be opened anymore. Any ideas where the problem in the file structure can be found?
Comment 3 Michal Thoma 2011-11-08 08:10:14 UTC
My LibExiv2 is 0.21.1 and LibKExiv 2.0.0
Comment 4 Marcel Wiesweg 2012-03-15 20:59:52 UTC
With the sidecar fixes applied for next digikam 2.6, current exiv2 and libkexiv2, I could successfully edit the image's metadata without creating corruption.