Bug 193228 - Experimental Exiv2 option "write metadata to RAW files" corrupts Nikon NEFs - Use ExifTool instead
Summary: Experimental Exiv2 option "write metadata to RAW files" corrupts Nikon NEFs -...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-ExifTool (show other bugs)
Version: 0.10.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-19 12:53 UTC by Christian Ide
Modified: 2022-04-08 05:27 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Ide 2009-05-19 12:53:16 UTC
Version:           0.10.0 (using 4.2.2 (KDE 4.2.2), Kubuntu packages)
Compiler:          cc
OS:                Linux (i686) release 2.6.28-12-generic

I just tried the experimental option "write metadata to Raw files" and added iptc tags to a Nikon NEF (from a D70s). In the file tags and other information already existed which were set by Nikon ViewNX under Windows. 

After saving the tags in DigiKam the file was corrupted so that it is impossible to extract the image data any more. UFRaw only shows a magenta image and RawTherapee shows a black and white version of the image (with about 4 levels of grey). 

The good news: the added keywords can be seen in RawTherapee. 

My version of DigiKam: 0.10.0 under Ubuntu 9.04
Comment 1 caulier.gilles 2009-05-19 12:57:47 UTC
Christian,

This is fully relevant of Exiv2 library. Check if you use last Exiv2 0.18.1 (see Help Component Info for details)

Gilles Caulier
Comment 2 Christian Ide 2009-05-19 13:03:11 UTC
Version 0.18 of libexiv2 is installed.
Comment 3 caulier.gilles 2009-05-19 13:07:54 UTC
Well, install Exiv2 0.18.1, and you need to recompile libkexiv2 + digiKam +kipi-plugins. Binary compatibility is not preserved between Exiv2 0.18.0 and 0.18.1. Check in Help/Components info if Exiv2 0.18.1 is used after compilation

Gilles Caulier
Comment 4 Christian Ide 2009-05-19 13:29:48 UTC
Sorry, but I can't compile DigiKam at the moment, because I only use an ubuntu system from USB stick for testing purpose. I can only use the default packages via apt. I am also away for a few weeks. But afterwards I will install ubuntu on my laptop persistently and I can do further testing. 

I just attach the raw file whith wich I tested the addition of metadata. (Sorry for the poor picture. I was just testing a new strobe. :-)
Comment 5 Andreas Huggel 2009-05-19 14:24:27 UTC
Christian,

Yes, I'd like to look at the image. Can you attach (or send to me at ahuggel at gmx dot net) one before and after the modification?

Andreas
Comment 6 Christian Ide 2009-05-19 15:35:04 UTC
Andreas,

the files are to large for attachement. I'll send the files via email.

Christian
Comment 7 Andreas Huggel 2009-05-20 05:26:11 UTC
ok, thanks.
Comment 8 Andi Clemens 2009-05-22 09:33:30 UTC
Oh damn, I can confirm this!
Since I tagged my NEFs, they are all broken. I really hope they are not destroyed forever, because my backup has those tags in it now, too ;-(

Andi
Comment 9 Andi Clemens 2009-05-22 14:07:39 UTC
Hmm I don't think this is a problem of metadata writing.
I can not open other NEFs in digiKam's RAW importer, too. They have no metadata written at all.
In UFRaw they are displayed correctly.

Gilles,
have we changed RAWimport code somehow in the last days?

Andi
Comment 10 Andreas Huggel 2009-05-22 15:59:26 UTC
Andi,

Did you also edit your images with Nikon ViewNX first?
If not, can you please send me a good sample (before editing it with digiKam)

Thanks,
Andreas
ahuggel at gmx dot net
Comment 11 Andreas Huggel 2009-05-22 16:28:13 UTC
It's an exiv2 bug: http://dev.exiv2.org/issues/show/636
Not good. Not good at all.

Andreas
Comment 12 Andi Clemens 2009-05-23 10:39:31 UTC
Hi Andreas,

I just discovered that my problems seems to be something else.
I reinstalled KDE and its libs and used the libkexiv and libkdcraw libraries that come with KDE 4.2.3.
But unfortunately these libs seem to be broken, because every single RAW file I tested (NEF, ORF etc) had this strange effect.
Normally I work with the SVN version of these libraries, but I wanted to see if everything compiles fine when you use the shipped ones.
Sometimes you get user complaints that something is not working, you test it and can't seem to find anything, because it is already fixed in SVN (or because the current lib is just not compatible with current digiKam code).
So it is always nice to test features with the "old code", too! :-)

But this seems to be the problem here. Current stable / official libkeviv dcraw etc seem to have an error that makes importing RAW files impossible in digiKam.

I still use exiv-0.18 and I can not confirm that metadata writing is killing NEFs, but I will do further testings.

Gilles,

is it possible that the current stable versions of these libraries are broken?
Archlinux is a rolling release distribution, so you normally have all the new stuff immediately. If Archlinux is broken, chances are that all the other distributions are broken, too.

These are my components at the moment:

digiKam version 0.11.0-svn
Exiv2 can write to Jp2: Yes
Exiv2 can write to Jpeg: Yes
Exiv2 can write to Png: Yes
Exiv2 can write to Tiff: Yes
Exiv2 supports XMP metadata: Yes
LibCImg: 130
LibExiv2: 0.18
LibJPEG: 62
LibJasper: 1.900.1
LibKDE: 4.2.3 (KDE 4.2.3)
LibKExiv2: 0.6.0
LibKdcraw: 0.5.0
LibLCMS: 118
LibPNG: 1.2.36
LibQt: 4.5.1
LibRaw: 0.7.2
LibTIFF: LIBTIFF, Version 3.8.2 Copyright (c) 1988-1996 Sam Leffler Copyright (c) 1991-1996 Silicon Graphics, Inc.
Marble widget: 0.7.1
Parallelized demosaicing: Yes
LibGphoto2: 2.4.5
LibKipi: 0.4.0

Andi
Comment 13 Andi Clemens 2009-05-23 10:53:34 UTC
Hmm actually I wanted to post the broken setup now, but reinstalling the default package is not working, I still can import RAW files now.
Maybe some SVN code is left somewhere. I need to remove those files be hand now.
But this will take some time, don't want to break anything now.

Andi
Comment 14 Andreas Huggel 2009-05-23 11:59:23 UTC
Andi,

I suggest you report your issue as a different bug once you can reproduce it again. The issue originally reported here is quite clearly (now at least, after investigating for half a day) an exiv2/dcraw problem (see the Exiv2 bug I linked to earlier).

Andreas
Comment 15 caulier.gilles 2009-05-23 23:27:31 UTC
Andi,

in RawImport, the only changes are RExpanderBox widget support. Next libkdcraw will include it and code is hosted to my svn home folder from KDE subversion repository.

Here 3 computers : 

1 with libkdcraw from KDE 4.2.2 and digiKam from trunk => work fine
1 with libkdcraw from KDE 4.2.3 and digiKam from trunk => work fine
1 with libkdcraw from my svn home and digiKam from trunk => work fine

Gilles Caulier
Comment 16 Andi Clemens 2009-05-23 23:53:32 UTC
Hmm after restarting I can confirm this import error again (looks like only one channel is displayed).
I now have the libkdcraw from 4.2.3 again, it simply isn't working.

I will checkout exiv2-0.18.1 tomorrow and see if metadata adding will corrupt my NEFs (after backup of course :-))

Andi
Comment 17 caulier.gilles 2009-05-28 13:59:07 UTC
Too all,

Andreas as found the solution in Exiv2 bugzilla. Please follow instructions :

http://dev.exiv2.org/issues/show/636

... and use Exiv2 from trunk if you want to play with NEF metadata with digiKam.

Good news : your NEF picture is not corrupted (:=)))

I close this file now...

Gilles Caulier
Comment 18 caulier.gilles 2022-04-08 05:27:36 UTC
Git commit 232040bdd51ba615ba3c2ac04e4846a3cf80c1af by Gilles Caulier.
Committed on 08/04/2022 at 05:24.
Pushed by cgilles into branch 'master'.

More files closed with ExifTool backend used to write metadata to RAW files instead Exiv2.
Related: bug 235171, bug 236127, bug 291627, bug 305823, bug 317745, bug 234181, bug 366406, bug 168064, bug 134487
FIXED-IN: 8.0.0

M  +14   -4    NEWS

https://invent.kde.org/graphics/digikam/commit/232040bdd51ba615ba3c2ac04e4846a3cf80c1af