Summary: | preview-pictures seem to be handled differently by Digikam and Konqueror | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Heiko Braun <heiko.braun> |
Component: | Preview-Image | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 0.7.4 | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.0 | |
Sentry Crash Report: |
Description
Heiko Braun
2006-03-16 20:24:31 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()) { 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 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()) { Both stable and trunk implementation fixed. Tested indeep and work fine. I close this file Gilles Caulier 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 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) 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) 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) |