Bug 123742 - preview-pictures seem to be handled differently by Digikam and Konqueror
Summary: preview-pictures seem to be handled differently by Digikam and Konqueror
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Preview-Image (show other bugs)
Version: 0.7.4
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-16 20:24 UTC by Heiko Braun
Modified: 2017-07-15 14:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 0.9.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Heiko Braun 2006-03-16 20:24:31 UTC
Version:           0.7.4 (using KDE KDE 3.4.2)
Installed from:    SuSE RPMs
OS:                Linux

Digikam seems to handle preview-pics differently than Konqueror concerning the orientation, though they share the same previews. This bug occurs when browsing a digikam-albumfolder with konqueror or when using an existing folder as album with digikam.
Obviously Konqueror stores the previews after turning them  in the right direction - so all preview-pics should have the orientation 'normal'
Digikam stores the previews exactly as the originals and takes care of the 'orientation'-Tag in the metadata of the picture.
This makes preview-pics creaed with Digikam appear lying on their side in Konqueror and versa visa.
Comment 1 caulier.gilles 2006-04-04 10:23:57 UTC
SVN commit 526246 by cgilles:

digikam from trunk : process exif auto-rotation before to save thumbnail file in ~/.thumbnails. This way is homogenous with konqueror.

NOTE: 'stable' svn branch not yet fixed (0.8.2). I'm waiting some feedback before to do...

CCMAIL: digikam-devel@kde.org
CCBUGS: 123742

 M  +3 -2      digikamthumbnail.cpp  


--- trunk/extragear/graphics/digikam/kioslave/digikamthumbnail.cpp #526245:526246
@@ -366,6 +366,9 @@
 
         if (img.depth() != 32)
             img = img.convertDepth(32);
+            
+        if (exif)
+            exifRotate(url.path(), img);
 
         img.setText(QString("Thumb::URI").latin1(),
                      0, uri);
@@ -384,8 +387,6 @@
     }
 
     img = img.smoothScale(size, size, QImage::ScaleMin);
-    if (exif)
-        exifRotate(url.path(), img);
 
     if (img.isNull())
     {
Comment 2 caulier.gilles 2006-04-04 10:27:19 UTC
To perform tests using digiKam and konqueror with some JPEG files vertically oriented, you can use my test images availalble here :

http://digikam3rdparty.free.fr/TEST_IMAGES/JPEG/

Gilles Caulier

Comment 3 caulier.gilles 2006-04-07 08:46:01 UTC
SVN commit 527168 by cgilles:

digikam from stable : process exif auto-rotation before to save thumbnail file in ~/.thumbnails. This way is homogenous with konqueror.

CCMAIL: digikam-devel@kde.org
CCBUGS: 123742

 M  +6 -11     digikamthumbnail.cpp  


--- branches/stable/extragear/graphics/digikam/kioslave/digikamthumbnail.cpp #527167:527168
@@ -298,12 +298,10 @@
     createThumbnailDirs();
 }
 
-
 kio_digikamthumbnailProtocol::~kio_digikamthumbnailProtocol()
 {
 }
 
-
 void kio_digikamthumbnailProtocol::get(const KURL& url )
 {
     int  size =  metaData("size").toInt();
@@ -334,7 +332,6 @@
         error(KIO::ERR_INTERNAL, i18n("File does not exist"));
         return;
     }
-
     
     img = loadPNG(thumbPath);
     if (!img.isNull())
@@ -377,13 +374,13 @@
 
         if (img.depth() != 32)
             img = img.convertDepth(32);
+            
+        if (exif)
+            exifRotate(url.path(), img);            
 
-        img.setText(QString("Thumb::URI").latin1(),
-                     0, uri);
-        img.setText(QString("Thumb::MTime").latin1(),
-                     0, QString::number(st.st_mtime));
-        img.setText(QString("Software").latin1(),
-                     0, QString("Digikam Thumbnail Generator"));
+        img.setText(QString("Thumb::URI").latin1(), 0, uri);
+        img.setText(QString("Thumb::MTime").latin1(), 0, QString::number(st.st_mtime));
+        img.setText(QString("Software").latin1(), 0, QString("Digikam Thumbnail Generator"));
 
         KTempFile temp(thumbPath + "-digikam-", ".png");
         if (temp.status() == 0)
@@ -395,8 +392,6 @@
     }
 
     img = img.smoothScale(size, size, QImage::ScaleMin);
-    if (exif)
-        exifRotate(url.path(), img);
 
     if (img.isNull())
     {
Comment 4 caulier.gilles 2006-04-07 08:48:53 UTC
Both stable and trunk implementation fixed. Tested indeep and work fine. I close this file

Gilles Caulier
Comment 5 caulier.gilles 2006-04-07 09:18:28 UTC
IMPORTANT : 

digikam take a care about Exif orientation tag to compute thumb (if option is enable of course). The images are always right oriented in preview.

konqueror do not take a  care about exif orientation tag (tested with KDE 3.4.2)

This is want mean that if you use digikam to compute previews before to use konqueror, all thumbs will be right in konqueror. In other way, if konqueror is used to compute thumbs before to use digiKam, the thumb will be wrong in digiKam...

Gilles Caulier
Comment 6 Roger Larsson 2006-05-06 23:34:06 UTC
Some cameras (Canon) seems to rotate the embedded thumbnail, others don't
(Nikon). 

So the result will depends on if the konqueror option to use embedded thumbnails or not. (in Preview and Metadata)

Comment 7 caulier.gilles 2006-05-27 12:48:14 UTC
SVN commit 545326 by cgilles:

digikam from stable: always use thumbnails generated by digiKam kio slave, not kde thumbnails generator.
CCBUGS: 119946, 123742

 M  +14 -10    digikamthumbnail.cpp  


--- branches/stable/extragear/graphics/digikam/kioslave/digikamthumbnail.cpp #545325:545326
@@ -21,6 +21,8 @@
  * ============================================================ */
 
 #define XMD_H
+#define PNG_BYTES_TO_CHECK 4
+#define DigiKamFingerPrint "Digikam Thumbnail Generator"
 
 // Qt Includes.
 
@@ -139,8 +141,6 @@
        thumb = thumb.xForm( matrix );
 }
 
-#define PNG_BYTES_TO_CHECK 4
-
 static QImage loadPNG(const QString& path)
 {
     png_uint_32         w32, h32;
@@ -264,9 +264,8 @@
     }
 
     int sizeOfUint = sizeof(unsigned int);
-    for (i = 0; i < h; i++)
-        lines[i] = ((unsigned char *)(qimage.bits())) +
-                   (i * w * sizeOfUint);
+    for (i = 0 ; i < h ; i++)
+        lines[i] = ((unsigned char *)(qimage.bits())) + (i * w * sizeOfUint);
 
     png_read_image(png_ptr, lines);
     free(lines);
@@ -274,7 +273,8 @@
     png_textp text_ptr;
     int num_text=0;
     png_get_text(png_ptr,info_ptr,&text_ptr,&num_text);
-    while (num_text--) {
+    while (num_text--) 
+    {
         qimage.setText(text_ptr->key,0,text_ptr->text);
         text_ptr++;
     }
@@ -288,7 +288,7 @@
 }
 
 kio_digikamthumbnailProtocol::kio_digikamthumbnailProtocol(int argc, char** argv) 
-    : SlaveBase("kio_digikamthumbnail", argv[2], argv[3])
+                            : SlaveBase("kio_digikamthumbnail", argv[2], argv[3])
 {
     argc_ = argc;
     argv_ = argv;
@@ -331,11 +331,15 @@
         error(KIO::ERR_INTERNAL, i18n("File does not exist"));
         return;
     }
+
+    // NOTE: if thumbnail have not been generated by digiKam (konqueror for example),
+    //       force to recompute it, else we use it.
     
     img = loadPNG(thumbPath);
     if (!img.isNull())
     {
-        if (img.text("Thumb::MTime") == QString::number(st.st_mtime))
+        if (img.text("Thumb::MTime") == QString::number(st.st_mtime) &&
+            img.text("Software")     == QString(DigiKamFingerPrint))
             regenerate = false;
     }
 
@@ -382,9 +386,9 @@
         if (exif)
             exifRotate(url.path(), img);            
 
-        img.setText(QString("Thumb::URI").latin1(), 0, uri);
+        img.setText(QString("Thumb::URI").latin1(),   0, uri);
         img.setText(QString("Thumb::MTime").latin1(), 0, QString::number(st.st_mtime));
-        img.setText(QString("Software").latin1(), 0, QString("Digikam Thumbnail Generator"));
+        img.setText(QString("Software").latin1(),     0, QString(DigiKamFingerPrint));
 
         KTempFile temp(thumbPath + "-digikam-", ".png");
         if (temp.status() == 0)
Comment 8 caulier.gilles 2006-05-27 12:49:37 UTC
SVN commit 545328 by cgilles:

digikam from trunk: always use thumbnails generated by digiKam kio slave, not kde thumbnails generator.
CCBUGS: 119946, 123742

 M  +10 -6     digikamthumbnail.cpp  


--- trunk/extragear/graphics/digikam/kioslave/digikamthumbnail.cpp #545327:545328
@@ -22,6 +22,7 @@
 
 #define XMD_H
 #define PNG_BYTES_TO_CHECK 4
+#define DigiKamFingerPrint "Digikam Thumbnail Generator"
 
 // C++ includes.
 
@@ -273,9 +274,8 @@
     }
 
     int sizeOfUint = sizeof(unsigned int);
-    for (i = 0; i < h; i++)
-        lines[i] = ((unsigned char *)(qimage.bits())) +
-                   (i * w * sizeOfUint);
+    for (i = 0 ; i < h ; i++)
+        lines[i] = ((unsigned char *)(qimage.bits())) + (i * w * sizeOfUint);
 
     png_read_image(png_ptr, lines);
     free(lines);
@@ -341,10 +341,14 @@
         return;
     }
 
+    // NOTE: if thumbnail have not been generated by digiKam (konqueror for example),
+    //       force to recompute it, else we use it.
+
     img = loadPNG(thumbPath);
     if (!img.isNull())
     {
-        if (img.text("Thumb::MTime") == QString::number(st.st_mtime))
+        if (img.text("Thumb::MTime") == QString::number(st.st_mtime) &&
+            img.text("Software")     == QString(DigiKamFingerPrint))
             regenerate = false;
     }
 
@@ -387,9 +391,9 @@
         if (exif)
             exifRotate(url.path(), img);
 
-        img.setText(QString("Thumb::URI").latin1(), 0, uri);
+        img.setText(QString("Thumb::URI").latin1(),   0, uri);
         img.setText(QString("Thumb::MTime").latin1(), 0, QString::number(st.st_mtime));
-        img.setText(QString("Software").latin1(), 0, QString("Digikam Thumbnail Generator"));
+        img.setText(QString("Software").latin1(),     0, QString(DigiKamFingerPrint));
 
         KTempFile temp(thumbPath + "-digikam-", ".png");
         if (temp.status() == 0)