Bug 311247 - Slideshow screensaver doesn't rotate Canon CR2 raw files to portrait mode
Summary: Slideshow screensaver doesn't rotate Canon CR2 raw files to portrait mode
Status: RESOLVED INTENTIONAL
Alias: None
Product: kscreensaver
Classification: Miscellaneous
Component: screensavers (show other bugs)
Version: 4.9.4
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kscreensaver bugs tracking
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-06 11:27 UTC by falolaf
Modified: 2015-01-23 14:33 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description falolaf 2012-12-06 11:27:08 UTC
I have setup kslideshow to randomly show images from my collection. A lot of these images are Canon CR2 raw files in portrait mode.

Now the problem is that the slideshow screensaver presents these portrait images in landscape mode. That is, slideshow doesn't obey to the exif rotation information.

I have altered the code as:
kWarning() << "Performing Exiv Rotation for QImage:";
kWarning() << exiv.rotateExifQImage(mImage, exiv.getImageOrientation());

To be able to see if rotation is done. Now the output from this is true for any images, portrait or landscape. The result is however images not rotated.

digiKam shows the images rotated, so it's possible to do it.



Reproducible: Always

Steps to Reproduce:
Activate slideshow screensaver and point to a folder containing Canon CR2 files in portrait mode.
Actual Results:  
Images not rotated.

Expected Results:  
Images should be rotated.

This happens on openSUSE 12.2 with KDE 4.8.4 and KDE 4.9.4.

I was advised to file a report against kexiv2, but I really don't know how to do that.
Comment 1 Oliver Henshaw 2013-03-12 19:55:08 UTC
Hopefully this is the right component.
Comment 2 caulier.gilles 2013-03-12 21:42:16 UTC
It's probably a problem with Exif rotation extraction tag taken from metadata by Exiv2 shared library. Which version do you use ? Which rotation flag do you see with your RAW when you use Exiv2 command line tool ?

Gilles Caulier
Comment 3 falolaf 2013-03-13 07:25:15 UTC
anders@yvette:~/astmp/exiv> exiv2 -V
exiv2 0.23 001700 (64 bit build)

anders@yvette:~/astmp/exiv> exiv2 -pt IMG_7013.CR2  | grep Orientation
Exif.Image.Orientation                       Short       1  top, right

This is on a machine running KDE 4.8.5.

Is this information enough?
Comment 4 caulier.gilles 2013-03-13 08:05:01 UTC
Where is the code from this screensaver. How this tool do to load image from raw file ? how it deal with tag rotation flag ?

RAW file are mess and complex to manage...

Gilles Caulier
Comment 5 falolaf 2013-03-14 09:20:24 UTC
Here's the code located:
kdeartwork/kscreensaver/kdesavers/slideshow.cpp

About row 900:
exiv.rotateExifQImage(mImage, exiv.getImageOrientation());

/Anders
Comment 6 caulier.gilles 2013-03-14 09:37:04 UTC
I cannot find KDEArtWork in git repository... It still in SVN ?

Gilles Caulier
Comment 7 falolaf 2013-03-14 09:48:08 UTC
Oh, that I don't know! I downloaded kdeartwork source from kde.org...

/Anders
Comment 8 Jekyll Wu 2013-03-14 09:50:12 UTC
(In reply to comment #6)
> I cannot find KDEArtWork in git repository... It still in SVN ?
> 
> Gilles Caulier

http://websvn.kde.org/trunk/KDE/kdeartwork/
Comment 9 caulier.gilles 2013-03-14 10:08:45 UTC
Problem is in slideshow.cpp implementation.

Here you try to load RAW image using QImage container. QImage do not support RAW file through Qt or KDE image loader.

Canon RAW file are tiff/ep based format. QT detect TIFF and use relevant loader which is exist in KDELibs.

... But it's wrong. definitively the image loaded by this way is not the right image.

To resume : RAW format are complex container with multiple image embeded, including RAW data, JPEG preview embeded, and metadata...

To load RAW image preview, you need to use libkdcraw from kdegraphics (the companion of libkexiv2). This lib is also done by digiKam team.

Loading RAW preview in QImage is very simple. Look code from Kipi-plugin OpenGL image viewer as example :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/imageviewer/texture.cpp#L124

Code to autorotate image based on KEXiv2 is also included in this method. It use KPImageInfo which return orientation flags from KIPI host, which is in fact Exif orientation flag...

Gilles Caulier
Comment 10 falolaf 2013-03-15 08:18:16 UTC
Ok, so I gave it a try but I get these errors:
kscreensaver/kdesavers/slideshow.cpp: In member function ‘virtual void SlideShowSaver::loadNextImage()’:
kscreensaver/kdesavers/slideshow.cpp:906:9: error: ‘KPMetadata’ has not been declared
kscreensaver/kdesavers/slideshow.cpp:909:9: error: ‘loadRawPreview’ is not a member of ‘KDcrawIface::KDcraw’

Now, I'm not familiar at all with this code... Not any of it!

/Anders
Comment 11 caulier.gilles 2013-03-15 08:23:47 UTC
>kscreensaver/kdesavers/slideshow.cpp:906:9: error: ‘KPMetadata’ has not been declared

Replace KPMetadata by KExiv2 class.

>kscreensaver/kdesavers/slideshow.cpp:909:9: error: ‘loadRawPreview’ is not a member of ‘KDcrawIface::KDcraw’

Yes, it is :

https://projects.kde.org/projects/kde/kdegraphics/libs/libkdcraw/repository/revisions/master/entry/libkdcraw/kdcraw.h#L77

Do you include kdcraw.h ?

You must to link too with libkdcraw at end... 

Gilles Caulier
Comment 12 falolaf 2013-03-15 08:35:47 UTC
kscreensaver/kdesavers/slideshow.cpp: In member function ‘virtual void kSlideShowSaver::loadNextImage()’:
kscreensaver/kdesavers/slideshow.cpp:906:9: error: ‘isRawFile’ is not a member of ‘KExiv2Iface::KExiv2’
kscreensaver/kdesavers/slideshow.cpp:909:9: error: ‘loadRawPreview’ is not a member of ‘KDcrawIface::KDcr

There's a loadDcrawPreview function.

/anders
Comment 13 caulier.gilles 2013-03-15 08:41:44 UTC
>kscreensaver/kdesavers/slideshow.cpp:906:9: error: ‘isRawFile’ is not a member of ‘KExiv2Iface::KExiv2’

Just copy this method in your code :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/common/libkipiplugins/tools/kpmetadata.cpp#L167

>kscreensaver/kdesavers/slideshow.cpp:909:9: error: ‘loadRawPreview’ is not a member of >‘KDcrawIface::KDcr

>There's a loadDcrawPreview function.

Use this one instead. This want mean that you use an very older release of libkdcraw. method have been renamed since a long time...

Gilles Caulier
Comment 14 falolaf 2013-03-15 14:53:51 UTC
I have copied and get this:
In file included from /usr/include/QtCore/qdir.h:45:0,
                 from /usr/include/QtCore/QDir:1,
                 from kscreensaver/kdesavers/slideshow.cpp:13:
/usr/include/QtCore/qstring.h: In member function ‘bool kSlideShowSaver::isRawFile(const KUrl&)’:
/usr/include/QtCore/qstring.h:597:5: error: ‘QString::QString(const char*)’ is private
kscreensaver/kdesavers/slideshow.cpp:934:43: error: within this context

/Anders
Comment 15 caulier.gilles 2013-03-15 15:02:08 UTC
It sound like your Qt is compiled with some restrictions about point to string :

http://qt-project.org/doc/qt-4.8/qstring.html#QString-8

Try one on these 3 methods instead :

http://qt-project.org/doc/qt-4.8/qstring.html#fromAscii

.. to replace this line :
QString rawFilesExt(KDcraw::rawFiles());

by something like :
QString rawFilesExt = QString::fromAscii((KDcraw::rawFiles()));

Gilles Caulier
Comment 16 Martin Flöser 2015-01-23 14:33:34 UTC
The screen locker architecture changed with Plasma 5. The classic screen savers are no longer supported. The 4.x series won't see any further feature development, so this bug report won't be implemented as it doesn't apply to our current version any more.

I want to thank you for your bug report and for helping improving the quality of our software and I'm sorry that we were not able to provide a fix before we retired the affected component.