[Digikam-devel] [Bug 125916] Problem with opening 16bit TIFF
Gilles Caulier
caulier.gilles at free.fr
Wed Apr 19 23:21:38 BST 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=125916
------- Additional Comments From caulier.gilles free fr 2006-04-20 00:21 -------
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: digikam-devel kde org
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);
More information about the Digikam-devel
mailing list