SVN commit 531715 by cgilles:
digikam from trunk : Fix broken thumbnail creation by digiKam KIO-slave with 16 bits TIFF images unrecognized properly by dcraw::parse method like a real tiff images. CCBUGS: 125916 CCMAIL: [hidden email] M +32 -8 digikamthumbnail.cpp M +1 -0 digikamthumbnail.h --- trunk/extragear/graphics/digikam/kioslave/digikamthumbnail.cpp #531714:531715 @@ -35,6 +35,7 @@ #include <qimage.h> #include <qdatastream.h> #include <qfile.h> +#include <qfileinfo.h> #include <qdir.h> #include <qwmatrix.h> #include <qregexp.h> @@ -337,17 +338,22 @@ if (regenerate) { - // Try JPEG loading : JPEG files without using Exif Thumb. - if ( !loadJPEG(img, url.path())) + // In first we trying to load image using the file extension. This is mandatory because + // some tiff files are detected like RAW files by dcraw::parse method. + if ( !loadByExtension(img, url.path()) ) { - // Try to load with dcraw : RAW files. - if (!loadDCRAW(img, url.path())) + // Try JPEG loading : JPEG files without using Exif Thumb. + if ( !loadJPEG(img, url.path()) ) { - // Try to load with DImg : TIFF, PNG, etc. - if (!loadDImg(img, url.path())) + // Try to load with dcraw : RAW files. + if (!loadDCRAW(img, url.path()) ) { - // Try to load with KDE thumbcreators : video files and others stuff. - loadKDEThumbCreator(img, url.path()); + // Try to load with DImg : TIFF, PNG, etc. + if (!loadDImg(img, url.path()) ) + { + // Try to load with KDE thumbcreators : video files and others stuff. + loadKDEThumbCreator(img, url.path()); + } } } } @@ -427,6 +433,24 @@ finished(); } +bool kio_digikamthumbnailProtocol::loadByExtension(QImage& image, const QString& path) +{ + QFileInfo fileInfo(path); + if (!fileInfo.exists()) + return false; + + QString ext = fileInfo.extension().upper(); + + if (ext == QString("JPEG") || ext == QString("JPG")) + return (loadJPEG(image, path)); + else if (ext == QString("PNG")) + return (loadDImg(image, path)); + else if (ext == QString("TIFF") || ext == QString("TIF")) + return (loadDImg(image, path)); + + return false; +} + ///////////////////////////////////////////////////////////////////////////////////////// // JPEG Extraction --- trunk/extragear/graphics/digikam/kioslave/digikamthumbnail.h #531714:531715 @@ -44,6 +44,7 @@ private: + bool loadByExtension(QImage& image, const QString& path); bool loadJPEG(QImage& image, const QString& path); bool loadDImg(QImage& image, const QString& path); bool loadKDEThumbCreator(QImage& image, const QString& path); _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |