Bug 381432

Summary: Olympus ORF files to DNG conversion fails in Windows 10
Product: [Applications] digikam Reporter: Grix <grix>
Component: Plugin-Bqm-DngConverterAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, formywebuse, kristian.hermann.karl, metzpinguin
Priority: NOR    
Version: 5.6.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 5.8.0
Sentry Crash Report:
Attachments: Debugview
ORF to DNG conversion debugview log

Description Grix 2017-06-20 10:14:27 UTC
Olympus ORF files to DNG conversion still failing in Windows 10 as it does in vrs. 5.5. Only thumbnails are correct. Images are black

Linux version works OK

Thanks
Comment 1 caulier.gilles 2017-06-20 10:58:04 UTC
Strange. Nothing has changed in DNG tool source code between 5.5.0 and 5.6.0
Comment 2 Grix 2017-06-20 14:38:19 UTC
(In reply to caulier.gilles from comment #1)
> Strange. Nothing has changed in DNG tool source code between 5.5.0 and 5.6.0

Exactly, nothing has changed. It STILL not working
the bug remains there since version 5.5
Only in Windows 10 (I don't know in Win 8 or 8.1)

Thanks

Guillermo Munoz
Comment 3 caulier.gilles 2017-06-20 14:40:59 UTC
Do you see anything special on DebugView program while digiKam and DNG tool is running ?

Gilles Caulier
Comment 4 Grix 2017-06-20 15:00:12 UTC
(In reply to caulier.gilles from comment #3)
> Do you see anything special on DebugView program while digiKam and DNG tool
> is running ?
> 
> Gilles Caulier

Sorry, don´t know where is the debug view
Comment 5 caulier.gilles 2017-06-20 15:05:59 UTC
DebugView is a separated program to take from M$ repository. It trace all debug statements printed by an application. This is typically done in a console under Linux. Under Windows, it's of course different. You nned a separate tool for that.

Look instructions here :

https://www.digikam.org/contribute/

Gilles Caulier
Comment 6 Grix 2017-06-20 15:22:13 UTC
Created attachment 106192 [details]
Debugview

dng.log
Comment 7 Grix 2017-06-20 15:24:49 UTC
I send the debugview log.
The image I was triying to convert was "_5270021.ORF"

Thanks 

Guillermo M
Comment 8 caulier.gilles 2017-06-20 15:32:05 UTC
These messages are strange :

00000057	58.28675461	[5132] digikam.general: DNGWriter: Backup Makernote ( 3350  bytes)	
00000058	58.28700638	[5132] digikam.general: DNGWriter: Build DNG Negative	
00000059	58.58262634	[8844] shell\osshell\lmui\ntshrui\dll\shrengine.cpp(1487)\ntshrui.dll!00007FFC5DF78800: (caller: 00007FFC5DF746A4) ReturnHr(93) tid(f00) 80004005 Error no especificado 	
00000060	58.58441162	[8844] shell\osshell\lmui\ntshrui\dll\shrengine.cpp(1487)\ntshrui.dll!00007FFC5DF78800: (caller: 00007FFC5DF746A4) ReturnHr(94) tid(f00) 80004005 Error no especificado 	
00000061	58.64415741	[5132] digikam.general: DNGWriter: DNG preview image creation	
00000062	58.64589691	[8844] shell\osshell\lmui\ntshrui\dll\shrengine.cpp(1487)\ntshrui.dll!00007FFC5DF78800: (caller: 00007FFC5DF746A4) ReturnHr(95) tid(1cac) 80004005 Error no especificado 	
00000063	58.64961243	[8844] shell\osshell\lmui\ntshrui\dll\shrengine.cpp(1487)\ntshrui.dll!00007FFC5DF78800: (caller: 00007FFC5DF746A4) ReturnHr(96) tid(1cac) 80004005 Error no especificado 	
00000064	58.96632385	[8844] shell\osshell\lmui\ntshrui\dll\shrengine.cpp(1487)\ntshrui.dll!00007FFC5DF78800: (caller: 00007FFC5DF746A4) ReturnHr(97) tid(168) 80004005 Error no especificado 	
00000065	58.96857452	[8844] shell\osshell\lmui\ntshrui\dll\shrengine.cpp(1487)\ntshrui.dll!00007FFC5DF78800: (caller: 00007FFC5DF746A4) ReturnHr(98) tid(168) 80004005 Error no especificado 	
00000066	59.23292542	[5132] digikam.general: DNGWriter: DNG thumbnail creation	
00000067	59.23700333	[8844] shell\lib\bindctx.cpp(128)\explorerframe.dll!00007FFC5F2BF200: (caller: 00007FFC5F2E24EA) ReturnHr(37) tid(504) 80070057 El parámetro no es correcto. 	
00000068	59.23785782	[8844] shell\lib\bindctx.cpp(128)\explorerframe.dll!00007FFC5F2BF200: (caller: 00007FFC5F2E24EA) ReturnHr(38) tid(130) 80070057 El parámetro no es correcto. 	
00000069	59.59021759	[5132] digikam.general: DNGWriter: Creating DNG file  "BatchTool-Hp5132-_5270021.ORF.digikamtempfile.dng"	

While DNG creation, an internal error appears...

Gilles Caulier
Comment 9 caulier.gilles 2017-06-21 06:11:36 UTC
Can you share the ORF file to hack here ?

Do you have any Anti-Virus active ?

Gilles Caulier
Comment 10 caulier.gilles 2017-06-21 06:16:37 UTC
Do you have enough space of disk to process ?

Can you rename the ORF file without '_' in file name ?

Gilles Caulier
Comment 11 Grix 2017-06-22 08:08:20 UTC
Created attachment 106224 [details]
ORF to DNG conversion debugview log

I've tried both withot antivirus and with changed name and the result is the same. There is something with Exiv2 library than can't read  ORF data.
 Thanks

Guillermo
Comment 12 caulier.gilles 2017-06-22 09:41:59 UTC
If it's an Exiv2 failure with ORF, it must be easy to reproduce with Exiv2 CLI tool. The DNG converter use Exiv2 to extract Exif information from original to backport it to DNG. This include all the makernotes data, which are copied as a binary byte-array for compatibility.

So the Exiv2 CLI tool must report an exception when your ORF is parsed to show all metadata. Can you reproduce ?

Gilles Caulier
Comment 13 Grix 2017-06-22 10:00:25 UTC
Exiv2 CLI tool ?
What is that ? where can I get it ?
sorry I don't know about programming, can I use it ?

thanks

Guillermo M.
Comment 14 Grix 2017-06-22 10:05:10 UTC
I said that because I read this in debugview log:

00000050	10.30132675	[6184] digikam.metaengine: Will write Metadata to file "P:/3FOTOS/2017/05Mayo/rosaleda/BatchTool-Hp6184-_5210023.ORF.digikamtempfile.dng"	
00000051	10.30416393	[6184] digikam.metaengine: Exiv2 ( 3 ) :  Failed to read Olympus IFD Makernote header.	
00000052	10.30416393	[6184] 	
00000053	10.30426979	[6184] digikam.metaengine: Exiv2 ( 3 ) :  Failed to read Olympus IFD Makernote header.	
00000054	10.30426979	[6184] 	
00000055	10.30626297	[6184] digikam.metaengine: wroteComment:  false	
00000056	10.30811596	[6184] digikam.metaengine: wroteEXIF:  true	
00000057	10.30819511	[6184] digikam.metaengine: wroteIPTC:  true	
00000058	10.30830479	[6184] digikam.metaengine: wroteXMP:  true	
00000059	12.35677719	[6184] digikam.metaengine: Exiv2 ( 3 ) :  Failed to read Olympus IFD Makernote header.	
00000060	12.35677719	[6184] 	
00000061	12.35689831	[6184] digikam.metaengine: Exiv2 ( 3 ) :  Failed to read Olympus IFD Makernote header.	
00000062	12.35689831	[6184] 	
00000063	13.17096901	[6184] digikam.metaengine: Metadata for file "BatchTool-Hp6184-_5210023.ORF.digikamtempfile.dng" written to file.	
00000064	13.18894482	[6184] digikam.general: DNGWriter: DNG conversion complete...	


thanks 

Guillermo
Comment 15 caulier.gilles 2017-06-22 11:00:16 UTC
CLI = Command Line Interface.

Exiv2 is a library and also a console tools used to play with metadata. Look here :

http://www.exiv2.org/getting-started.html

Gilles Caulier
Comment 16 Grix 2017-06-22 17:46:04 UTC
Sorry, I´m not a programmer but in windows 10 nor CLI and exiv2 are recognized as commands.
In linux (where the conversion works OK) the shell tells me that nor cli or exiv2 are installed

thanks.

G.M.
Comment 17 caulier.gilles 2017-06-22 18:17:03 UTC
Which Exiv2 version do you use under Linux ? Look in digiKam Help/Components Info for details.

Under Windows, the bundle is compiled with last Exiv2 0.26.

Gilles Caulier
Comment 18 Grix 2017-06-22 18:47:49 UTC
Linux Ubuntu : digikam 5.5 Exiv2 0.25

Windows10 : digikam 5.6 Exiv2 0.26


G.M.
Comment 19 caulier.gilles 2017-06-22 20:24:40 UTC
Please try with the AppImage linux bundle 5.6.0, which use also Exiv2 0.26. If problem is reproducible, well the dysfunction is certainly located in Exiv2 library

Gilles Caulier
Comment 20 Grix 2017-06-22 20:47:23 UTC
I´ll try but, does digikam 5.5 for windows use Exiv2 0.26 ?
Remember that the problem was also on that version.

Thanks

Guillermo M.
Comment 21 caulier.gilles 2017-06-22 20:50:32 UTC
Yes digiKam 5.5.0 for windows also use Exiv2 0.26 (code not released at 5.5.0 date and taken from subversion repository)

Gilles Caulier
Comment 22 caulier.gilles 2017-06-23 07:00:03 UTC
*** Bug 378929 has been marked as a duplicate of this bug. ***
Comment 23 Paul 2017-11-13 02:43:45 UTC
I'm new to Digikam by a few weeks. I have 5.7 installed on Win 10. The bug presents itself like so for me:

Olympus orf file use the "Batch Convert to DNG" I only get a black image, not even a thumbnail.

Import->Convert to DNG, I get a contrasty thumbnail but a black file otherwise.
Comment 24 caulier.gilles 2017-11-13 05:19:40 UTC
Please test if the problem is reproducible with current digiKam 5.8.0 pre-release bundle where libraw have been updated and where few bugs have been fixed with parallel processing.

https://files.kde.org/digikam/

Gilles Caulier
Comment 25 Paul 2017-11-14 02:07:23 UTC
Sorry to report... the issue persists.
Comment 26 Paul 2017-11-14 02:08:25 UTC
Sorry, pressed save too soon on that comment. 

The problem persists with 5.8pr
Comment 27 Paul 2017-11-14 02:08:59 UTC
Would it be helpful to have an orf file to test with?
Comment 28 caulier.gilles 2017-11-14 04:35:12 UTC
yes, an ORF test file will help. Please share through an Internet cloud link

Thanks in advance

Gilles Caulier
Comment 29 Paul 2017-11-14 05:12:16 UTC
I emailed a file link to you through Dropbox. I hope it helps!
Comment 30 Maik Qualmann 2017-11-14 11:29:40 UTC
Can you also send me the link to the ORF file?

Maik
Comment 31 Paul 2017-11-14 20:32:26 UTC
You've got it. Sending it now.
Comment 32 Maik Qualmann 2017-11-15 12:09:04 UTC
The cause is now found, Exiv2 kills the DNG. Depending on the memory contents, I can also reproduce graphics artefacts in the created DNG file under Linux. We remove an Olympus tag ("Exif.OlympusIp.BlackLevel") from the DNG because of an older bug report:

https://cgit.kde.org/digikam.git/tree/libs/dngwriter/dngwriter.cpp#n1258

If this write is removed, the DNG file will be perfect even under Windows. The problem from the older Bugreport I could not reproduce until now.

My conclusion: We disable all writes in RAW files still in digiKam 5.8.0.

Maik
Comment 33 Maik Qualmann 2017-11-15 17:49:53 UTC
Git commit d1706a6a9e9533eb58ea6d6ff0262853fa45a3d4 by Maik Qualmann.
Committed on 15/11/2017 at 17:47.
Pushed by mqualmann into branch 'master'.

disable writing metadata to RAW files to protect the files from damage
FIXED-IN: 5.8.0

M  +2    -1    NEWS
M  +1    -1    libs/dmetadata/metadatasettingscontainer.cpp
M  +3    -3    libs/dmetadata/metaengine.cpp
M  +3    -2    libs/dngwriter/dngwriter.cpp

https://commits.kde.org/digikam/d1706a6a9e9533eb58ea6d6ff0262853fa45a3d4
Comment 34 caulier.gilles 2017-11-15 19:37:53 UTC
Hi, Maik,

With this kind of patch, the Setup/Metadata/Write to Raw option will have no effect in background.

I recommend to drop definitively this option from the GUI, if there is no other work around solution to this bug with ORF files. After all i plan to do it since a very long time. We must preserve file data from end users.

Gilles
Comment 35 Maik Qualmann 2017-11-15 20:15:46 UTC
Hi Gilles,

currently the option write to RAW file is greyed out in the GUI. somehow I still hope for a further development of Exiv2. A version 0.26.1 seems to be planned. We know 3 RAW file types that have errors after writing metadata to the files, ARW, ORF and DNG.

Maik
Comment 36 Paul 2017-11-16 01:55:19 UTC
Glad the issue was found! Will this fix be included in the official 5.8 release?

Although, I would rather have the ability to create DNGs, it would indeed be a shame to never have the option to write metadata to DNG. I have no desire to write metadata to original raw formats, but writing to DNG opens up greater workflow possibilities.

Thanks for the quick work!
Comment 37 Grix 2018-03-07 14:25:35 UTC
Finally bug on ORF files in Windows versión of digikam is fixed in versión 5.8
I've tested in digikam 5.8, windows 10 creator's update and it Works ok.
Good work, I know those type of bugs are difficult to track so 
THANKS FOR YOUR GREAT JOB !