Bug 127179 - Digikam-0.8.2-rc1 thumbnails does not adhere to the Rotate Images setting in Configure Digikam
Summary: Digikam-0.8.2-rc1 thumbnails does not adhere to the Rotate Images setting in ...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Thumbs-Image (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-11 23:22 UTC by Magnus Larsson
Modified: 2007-07-01 12:25 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
The new batch thumbs processing tool in action from digikam 0.9.0-beta2 (197.16 KB, image/png)
2006-08-31 21:12 UTC, caulier.gilles
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Larsson 2006-05-11 23:22:07 UTC
Version:           0.8.2-rc1 (using KDE 3.5.2, compiled sources)
Compiler:          Target: i686-pc-linux-gnu
OS:                Linux (i686) release 2.6.16

Digikam-0.8.2-rc1 thumbnails does not adhere to the Rotate Images setting in Configure Digikam.

Test:
1) Settings->Configure digiKam->Embedded Info->
Rotate images and thumbnails according to EXIF tag.

2) Set to on. 

Result:
Thumbnail images is not rotated according to EXIF tag. (No change compared to off setting)

DigiKam-0.8.1 adheres to Rotate images and thumbnails according to EXIF tag. No problem when it comes to the thumbnails and the image editor. 

Digikam-0.8.2-beta1 has the same bug as Digikam-0.8.2-rc1.

However, selecting a thumbnail in 0.8.2-rc1, by clicking in order to start the image editor displays an image which is rotated correctly according to Settings->Configure digiKam->Embedded Info->
Rotate images and thumbnails according to EXIF tag.

uname -a
Linux lfs 2.6.16 #1 PREEMPT Mon Mar 20 20:01:45 CET 2006 i686 pentium4 i386 GNU/Linux

Compiled from source using gcc version 4.0.1.

Sincerely,

Magnus Larsson
Comment 1 Magnus Larsson 2006-05-11 23:41:41 UTC
The pictures used in the tests are all jpg straight from a Canon EOS-350D camera.

Best regards,

Magnus Larsson
Comment 2 caulier.gilles 2006-05-11 23:48:56 UTC
Magnus, please join your images like attachments in this thread to process tests. Thanks in advance

Gilles Caulier
Comment 3 Magnus Larsson 2006-05-12 00:02:22 UTC
Dear Gilles Caulier,

Please find a test picture attached, as per request.

http://gunnarlarsson.scorpionshops.com/DigiKam-test/img_1511.jpg

Best regards

Magnus Larsson
Comment 4 Magnus Larsson 2006-05-12 20:03:21 UTC
Dear Digikam community,

A correction. Please find new test pictures attached. 

http://gunnarlarsson.scorpionshops.com/DigiKam-test

img_1511--digikam-copy-function.jpg 
img_1511-straight-from-camera.jpg

The http://bugs.kde.org/show_bug.cgi?id=127179#c2 img_1511.jpg picture originally posted was NOT straight from the camera. It was created using the Digikam "copy" function and then pasted into the web server directory. It is renamed img_1511--digikam-copy-function.jpg.

The img_1511-straight-from-camera.jpg is what it says.

0.8.1 img_1511-straight-from-camera.jpg
Rotate Images setting 
on                off
OK (Portrait)     OK (Landscape)

0.8.2-rc1 img_1511-straight-from-camera.jpg
Rotate Images setting 
on                off
NOK (Landscape)   OK (Landscape)

Best regards,

Magnus Larsson






Comment 5 Roger Larsson 2006-05-25 01:46:54 UTC
I have tested the test pictures and it kind of works for me.
  But not without pain...
Note that cached thumbnails can disturb the function.
Remove cached thumbnails, between testruns, with:

 find ~/.thumbnails/ -name "*.png" | xargs -n 10 rm

Also note that konqueror uses the same cache!
If the images are viewed first in konqueror (that
does not rotate) then later viewing by digikam
will be wrong. (kthumbnail).

Magnus does this explain your problems?

But an additional problem exist - the embedded
thumbnail is already rotated by some cameras.
Like Canon A520. There is an option in
konqueror for this...

I guess we really would like to:
- Use embedded thumbnail if it exist
    to speed up icon view.
    I see no actual reason to have this user configurable,
    other than as a temporal work around.
- Be able to select if we want _thumbnail_
  to be shown as native as camera sees it
  or attempt to rotate using EXIF information.
    It is technically possible to save the thumbnail in
    native form and add a Orientation tag to the file...
- Use only one set of options for both konqueror
  and digikam (or use two sets of thumbnails).
  On option change - clean up cache if needed.

Suppose we forget cameras with prerotated thumbnails
for a while, where would the above functions be placed?
I would suggest imagethumbnail.so

To get perfect function additional info per camera model
will be needed - it can not be a configuration option
since one user might have several cameras that behaves
differently. This info can be stored in imagethumbnail.so
to (or an config file to go with it).
  Cameras that prerotate embedded thumbnail can be identified
automatically if the any embedded thumbnail is higher than
it is wide. (This will fail for all picture taken upside down
before first portrait - not bad)
Comment 6 Magnus Larsson 2006-05-25 14:38:29 UTC
Mr Roger Larsson,

I have tested to remove the thumbnails between tests.

>Note that cached thumbnails can disturb the function. 
> Remove cached thumbnails, between testruns, with: 
> 
>  find ~/.thumbnails/ -name "*.png" | xargs -n 10 rm 
> 
>Also note that konqueror uses the same cache! 
>If the images are viewed first in konqueror (that 
>does not rotate) then later viewing by digikam 
>will be wrong. (kthumbnail). 
>Magnus does this explain your problems? 

Yes, you are correct. 
1) remove thumbnails as per instruction above.
2) set rotation config parameter
3) go to album in order to generate thumbnails.
=> result: thumbnails and viewer are configured in a correct way.
4) counter test: reset the config rotation parameter
=> result: the thumbnails are NOT changed according to the parameter.
The thumbnails are nor re-generated.

I still consider the 0.8.2-rc1 behavior as a regression error.
The 0.8.1 version regenerates the thumbnails using the rotation parameter when changed, instantly, 0.8.2-rc1 does not. It keeps the old thumbnails once created (for me at least).

I am using Kipi lib 0.1.2.

Best regards,

Magnus Larsson
Comment 7 Aewyn Vienna 2006-08-17 20:11:22 UTC
this bug exist in 0.9.0 beta 1.

it does not show images the right way; neither thumbs nor in showfoto.
[removing thumbnail cache does not helps]

thanks, Aew
Comment 8 caulier.gilles 2006-08-30 12:28:29 UTC
SVN commit 578815 by cgilles:

digikam from trunk : When the Exif auto-rotation option is canged in setup dialog, digiKam ask now to user if the new batch tool to re-generate all albums items thumbnails must be started to refresh thumbs database.

CCBUGS: 127179, 110658, 128308

 M  +16 -0     setup.cpp  
 M  +25 -5     setupmetadata.cpp  
 M  +4 -1      setupmetadata.h  


--- trunk/extragear/graphics/digikam/utilities/setup/setup.cpp #578814:578815
@@ -30,11 +30,13 @@
 
 #include <klocale.h>
 #include <kiconloader.h>
+#include <kmessagebox.h>
 #include <kconfig.h>
 #include <kapplication.h>
 
 // Local includes.
 
+#include "batchthumbsgenerator.h"
 #include "setupgeneral.h"
 #include "setupmetadata.h"
 #include "setupidentity.h"
@@ -214,6 +216,20 @@
     d->slideshowPage->applySettings();    
     d->iccPage->applySettings();
     d->miscPage->applySettings();
+    
+    if (d->metadataPage->exifAutoRotateAsChanged())
+    {
+        QString msg = i18n("The Exif auto-rotate thumbnails option has been changed.\n"
+                           "Do you want to rebuild all albums items thumbnails now?\n\n"
+                           "Note: thumbnails processing can take a while!");
+        int result = KMessageBox::warningYesNo(this, msg);
+        if (result != KMessageBox::Yes)
+            return;
+
+        BatchThumbsGenerator *thumbsGenerator = new BatchThumbsGenerator(this);
+        thumbsGenerator->exec();
+    }
+
     close();
 }
 
--- trunk/extragear/graphics/digikam/utilities/setup/setupmetadata.cpp #578814:578815
@@ -58,6 +58,7 @@
 
     SetupMetadataPriv()
     {
+        ExifAutoRotateAsChanged   = false;
         saveCommentsBox           = 0;
         ExifRotateBox             = 0;
         ExifSetOrientationBox     = 0;
@@ -68,6 +69,9 @@
         saveCreditsIptcBox        = 0;
     }
 
+    bool       ExifAutoRotateAsChanged;
+    bool       ExifAutoRotateOrg;
+    
     QCheckBox *saveCommentsBox;
     QCheckBox *ExifRotateBox;
     QCheckBox *ExifSetOrientationBox;
@@ -163,16 +167,18 @@
     
     mainLayout->addWidget(hbox);
     mainLayout->addStretch();
+    mainLayout->addWidget(this);
 
+    readSettings();
+    adjustSize();
+  
     // --------------------------------------------------------
 
     connect(exiv2LogoLabel, SIGNAL(leftClickedURL(const QString&)),
             this, SLOT(processExiv2URL(const QString&)));
 
-    readSettings();
-    adjustSize();
-  
-    mainLayout->addWidget(this);
+    connect(d->ExifRotateBox, SIGNAL(toggled(bool)),
+            this, SLOT(slotExifAutoRotateToggled(bool)));
 }
 
 SetupMetadata::~SetupMetadata()
@@ -207,7 +213,8 @@
     AlbumSettings* settings = AlbumSettings::instance();
     if (!settings) return;
 
-    d->ExifRotateBox->setChecked(settings->getExifRotate());
+    d->ExifAutoRotateOrg = settings->getExifRotate();
+    d->ExifRotateBox->setChecked(d->ExifAutoRotateOrg);
     d->ExifSetOrientationBox->setChecked(settings->getExifSetOrientation());
     d->saveCommentsBox->setChecked(settings->getSaveComments());
     d->saveDateTimeBox->setChecked(settings->getSaveDateTime());
@@ -217,6 +224,19 @@
     d->saveCreditsIptcBox->setChecked(settings->getSaveIptcCredits());
 }
 
+bool SetupMetadata::exifAutoRotateAsChanged()
+{
+    return d->ExifAutoRotateAsChanged;
+}
+
+void SetupMetadata::slotExifAutoRotateToggled(bool b)
+{
+    if ( b != d->ExifAutoRotateOrg)
+        d->ExifAutoRotateAsChanged = true;
+    else
+        d->ExifAutoRotateAsChanged = false;
+}
+
 }  // namespace Digikam
 
 #include "setupmetadata.moc"
--- trunk/extragear/graphics/digikam/utilities/setup/setupmetadata.h #578814:578815
@@ -43,13 +43,16 @@
 
     void applySettings();
 
+    bool exifAutoRotateAsChanged();
+
 private:
 
     void readSettings();
 
 private slots:
 
-    void processExiv2URL(const QString& url);
+    void processExiv2URL(const QString&);
+    void slotExifAutoRotateToggled(bool);
 
 private:
 
Comment 9 caulier.gilles 2006-08-31 21:01:20 UTC
SVN commit 579297 by cgilles:

digikam from trunk : with showfoto, refresh all thumbbar items if exif auto-rotation option is changed in setup

CCBUGS: 127179

 M  +30 -1     thumbbar.cpp  


--- trunk/extragear/graphics/digikam/libs/thumbbar/thumbbar.cpp #579296:579297
@@ -22,12 +22,20 @@
  * 
  * ============================================================ */
 
+// C Ansi includes.
+
+extern "C"
+{
+#include <unistd.h>
+}
+
 // C++ includes.
 
 #include <cmath>
 
 // Qt includes. 
- 
+
+#include <qdir.h>
 #include <qpixmap.h>
 #include <qtimer.h>
 #include <qpainter.h>
@@ -38,6 +46,7 @@
 
 // KDE includes.
 
+#include <kmdcodec.h>
 #include <kfileitem.h>
 #include <kapplication.h>
 #include <kiconloader.h>
@@ -138,6 +147,26 @@
 void ThumbBarView::setExifRotate(bool exifRotate)
 {
     d->exifRotate = exifRotate;
+    QString thumbCacheDir = QDir::homeDirPath() + "/.thumbnails/";
+
+    for (ThumbBarItem *item = d->firstItem; item; item = item->m_next)
+    {
+        // Remove all current album item thumbs from disk cache.
+
+        QString uri = "file://" + QDir::cleanDirPath(item->url().path(-1));
+        KMD5 md5(QFile::encodeName(uri));
+        uri = md5.hexDigest();
+    
+        QString smallThumbPath = thumbCacheDir + "normal/" + uri + ".png";
+        QString bigThumbPath   = thumbCacheDir + "large/"  + uri + ".png";
+
+        ::unlink(QFile::encodeName(smallThumbPath));
+        ::unlink(QFile::encodeName(bigThumbPath));
+
+        invalidateThumb(item);
+    }
+    
+    triggerUpdate();
 }
 
 int ThumbBarView::countItems()
Comment 10 caulier.gilles 2006-08-31 21:06:31 UTC
Hey guy, 

In svn trunk (next digikam 0.9.0-beta2 planed during september), we have fixed a lot of problems with thumbnails. There is also a new batch thumbnails processing tool to update the thumbs database on the disk (no need to play with your ~/.thumbnails folder anymore.

Can you give us a feedback with the current implementation ? Thanks in advance

Gilles Caulier
Comment 11 caulier.gilles 2006-08-31 21:12:02 UTC
Created attachment 17591 [details]
The new batch thumbs processing tool in action from digikam 0.9.0-beta2
Comment 12 caulier.gilles 2007-04-17 08:19:37 UTC
Magnus,

digikam and Exiv2 library Exif rotation tag management have been fixed. Please test current digiKam implementation from svn (0.9.2-svn) with Exiv2 0.14

Thanks in advance

Gilles Caulier
Comment 13 Arnd Baecker 2007-06-12 15:23:18 UTC
Magnus, 

could you check the problem with 0.9.2-beta3 and Exiv2 0.14? It would
be nice to have the issue fully resolved before the final release of 0.9.2 
(which is going to happen soon!).

Many thanks in advance, 

Arnd
Comment 14 Arnd Baecker 2007-07-01 12:25:55 UTC
I am closing this bug, marking as FIXED.

Please feel free to re-open if there is any new information.

Arnd