Bug 191678

Summary: Exiv rotation for Pentax Pef not working
Product: [Applications] digikam Reporter: Michael <m.mickey>
Component: Metadata-OrientationAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahuggel, michal
Priority: NOR    
Version: 1.0.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 1.0.0
Sentry Crash Report:

Description Michael 2009-05-05 13:24:22 UTC
Version:            (using KDE 4.2.0)
OS:                Linux
Installed from:    Ubuntu Packages

Hi,

I compiled on a fresh Ubuntu Jaunty digikam 0.11 from SVN, with the tutorial for kubuntu http://wiki.kde.org/tiki-index.php?page=Digikam+Compilation+on+Kubuntu+Intrepid

I tried to rotate some of my Pef files with the exiv orientation tool, but I only get an error... 

I have the usual evix2 0.18 package from ubuntu installed...
The same procedure worked some while back with digikam 0.10 and exiv2 0.18pre on ubuntu intrepid...

greets mike


digiKam version 0.11.0-svn (rev.: 963706)
Exiv2 kann nicht in JP2 speichern: Ja
Exiv2 kann nicht in JPEG speichern: Ja
Exiv2 kann nicht in PNG speichern: Ja
Exiv2 kann nicht in TIFF speichern: Ja
Exiv2 supports XMP metadata: Ja
LibCImg: 130
LibExiv2: 0.18
LibJPEG: 62
LibJasper: 1.900.1
LibKDE: 4.2.2 (KDE 4.2.2)
LibKExiv2: 0.6.0
LibKdcraw: 0.5.0
LibLCMS: 118
LibPNG: 1.2.27
LibQt: 4.5.0
LibRaw: 0.7.2-Release
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: Keine
LibGphoto2: 2.4.2
LibKipi: 0.4.0
Comment 1 caulier.gilles 2009-05-05 13:51:39 UTC
>LibExiv2: 0.18

Can you try to use last stable Exiv2 0.18.1 with digiKam. libkexiv2, digiKam, and kipi-plugins need to be recompiled.

Question, when you said rotated image based on exif informations, you want mean thumb or real image. Typically, both use the same informations, but i would to be sure.

Gilles Caulier
Comment 2 Michael 2009-05-05 14:49:33 UTC
So I tried it with 0.18.1, but nothing changed... there is still just a errormessage and thats all...
I want to set the exiv orientation flag differently, this will rotate the thumbnail in digikam, but also when opening the rawfile the image itself will be shown in it's correct orientation...

greets mike
Comment 3 caulier.gilles 2009-05-05 15:29:47 UTC
Which error message exactly.

To be able to set orientation flag in PEF file, you need to set on the right option in Metadata config panel to write metadata in RAW file (disable by default)

Gilles Caulier
Comment 4 Michael 2009-05-05 15:38:12 UTC
I have enabled (still the same message):

Metadaten in Rohdaten speichern (experimentell)

This is the message:

Fehler bei der Bereinigung der EXIF-Ausrichtung für die Datei K20D0099.PEF.

greets mike
Comment 5 caulier.gilles 2009-05-05 15:59:11 UTC
Sorry, i don't speak German (:=)))

Gilles
Comment 6 Michael 2009-05-05 16:17:13 UTC
I didn't want to translate with probably the wrong words, but after setting digikam to english, here are the two lines:

Failed to revise Exif orientation for file K20D0099.PEF.

Write Metadata to RAW files (experimental)

greets mike
Comment 7 caulier.gilles 2009-05-05 16:59:28 UTC
Arfff...

Andreas, digiKam try to set Exif orientation flag in PEF file. Do you have already tried that ?

Gilles Caulier
Comment 8 Andreas Huggel 2009-05-06 04:19:40 UTC
According to the official documentation, writing to PEF should work ;)

http://dev.exiv2.org/wiki/exiv2/Supported_image_formats

We need more details of what is going wrong.

Andreas
Comment 9 Michal Thoma 2009-05-07 13:49:08 UTC
I confirm this behaviour at Ubuntu Jaunty, Digikam 0.10 width DNG files from Pentax *istD.

The metadata writing to RAW was turned on and editing EXIF, IPTC and XMP through Image > Metadata dialogs works properly.

Though Image > Exif Orientation tag setting (loose translation back to English) produce error "Couldn't read Exif orientation tag from image xxxx.dng".

Actually Exif Orientation tag is there and it look like that: Orientation: top, left.

Sample image: http://photos.thoma.cz/orientation
Comment 10 Michael 2009-05-18 22:09:53 UTC
Any news?

greets mike
Comment 11 Michal Thoma 2009-05-19 20:38:37 UTC
well if you need this feature urgently just employ exiftool commandline tool. I made script for 90 CCW rotation just this simple:

<code>
#!/bin/sh
exiftool -Orientation=8 -n -overwrite_original "$*"
</code>

I run it through the context menu and it works just fine.

Should help until it's in Digikam natively.
Comment 12 Andreas Huggel 2009-05-20 05:48:55 UTC
What happens if you do something similar to that exiftool command with the exiv2 command line tool? I.e., something like 

$ exiv2 -M 'set Exif.Image.Orientation 8' IMAGE.PEF

Here this seems work fine on one of my PEF samples; the image opens rotated in ufraw after the change.

Andreas
Comment 13 Michal Thoma 2009-05-20 11:16:31 UTC
This very same thing! I only use ExifTool because I'm more familiar with that (it's little bit older and more advanced project in regard of format and metadata support).

When I change the orientation tag I see the change in digikam instantly.
Comment 14 Andreas Huggel 2009-05-20 13:44:57 UTC
Yes, it should be the same. I'd like to hear the result that Michael gets, when running the command with one of his PEFs, which don't work with digiKam. It's a simple check if this is a bug for exiv2.
Comment 15 Michael 2009-05-20 14:16:18 UTC
It works on the commandline with exiv2.
Also digikam is able to change other exiv metadata like Original Date in my PEF files, only rotation doesn't work...

greets mike
Comment 16 Andreas Huggel 2009-05-23 16:01:11 UTC
Gilles,

This one needs more investigation by the digiKam team. Doesn't sound like an Exiv2 issue.

Andreas
Comment 17 caulier.gilles 2009-05-23 23:18:38 UTC
Andreas,

From libkexiv2, this error "Failed to revise Exif orientation for file K20D0099.PEF." is generated by this method :

http://lxr.kde.org/source/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2image.cpp#306

Sound like Exiv2 generate an exception. I suspect a problem with XMP with PEF data (for ex.)

Gilles Caulier
Comment 18 Michal Thoma 2009-05-24 00:45:09 UTC
I don't think this issue is limited to PEF. I have this problem with my DNGs (from Pentax) and just now I repeated the same wit NEF from Nikon D300.
Comment 19 Andreas Huggel 2009-05-24 05:07:37 UTC
Gilles,

I don't see where digiKam writes the error. Do you mean this, at the end of the function you pointed to?

357     catch( Exiv2::Error &e )
358     {
359         d->printExiv2ExceptionError("Cannot set Exif Orientation tag using Exiv2 ", e);
360     }

But that's a different message and it prints the Exiv2 exception, which I'd need to get an idea of what happened. But there is no Exiv2 exception anywhere in the original bug report. It says the error is just this:

"Failed to revise Exif orientation for file K20D0099.PEF.

Write Metadata to RAW files (experimental)"

Andreas
Comment 20 caulier.gilles 2009-05-24 10:04:46 UTC
Andreas,

Right, i thinking this message become from console. In fact it's a message box. Code is there :

http://lxr.kde.org/source/extragear/graphics/digikam/digikam/albumiconview.cpp#1778

In this case the failure to record orientation flags from PEF image come from libkexiv2::applyChanges() to record all in image. Note Digikam::DMetadata class is a derived version of libkexiv2 with some methods dedicated to play with internal digiKam metadata which are not shared with the rest of KDE.

Look applyChanges() code here :

http://lxr.kde.org/source/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp#439

It call save() method :

http://lxr.kde.org/source/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp#289

I will hack this part

Gilles
Comment 21 caulier.gilles 2009-05-24 10:17:39 UTC
Ok, i can see the problem in the console :

digikam(8427)/KEXIV2 KExiv2Iface::KExiv2::setImageOrientation: Exif.Image.Orientation tag set to:  6
digikam(8427)/KEXIV2 KExiv2Iface::KExiv2::save: ' imgp6384.pef ' is TIFF based RAW file supported but writing mode is disabled.  Metadata not saved.

Of course, "Write metadata to RAW files" option from digiKam settings panel is enabled...

Michael, can you confirm this, running digiKam from a console ?

Gilles Caulier
Comment 22 caulier.gilles 2009-05-24 11:42:54 UTC
SVN commit 972107 by cgilles:

when DMetadata is used to play with image information, unforget to register flags from albumsettings to follow digiKam configuration.
BUG: 191678


 M  +1 -0      albumiconview.cpp  
 M  +3 -1      metadatamanager.cpp  


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