[Digikam-devel] extragear/graphics/digikam/kioslave
Gilles Caulier
caulier.gilles at free.fr
Wed Jun 21 12:46:46 BST 2006
SVN commit 553524 by cgilles:
digikam from trunk : digiKam KIO slave image preview extractor use now the new DMetadata IPTC image preview extraction method ! It's very fast !!!
IMPORTANT : actually, digiKam image editor store a JPEG preview image of 640x680 compressed to 75% factor. Please let's me hear if these settings is right for you. Note that preview IPTC tag size is limited to 256 Kb to store image.
CCMAIL: digikam-devel at kde.org
M +26 -3 digikampreview.cpp
M +1 -0 digikampreview.h
--- trunk/extragear/graphics/digikam/kioslave/digikampreview.cpp #553523:553524
@@ -91,11 +91,14 @@
return;
}
- // Try to load with dcraw : RAW files.
+ // -- Get the image preview --------------------------------
+ // In first, we trying to load with dcraw : RAW files.
if ( !loadDCRAW(img, url.path()) )
{
- // Try to load with Qt/KDE.
- img.load(url.path());
+ // Try to extract Exif/Iptc preview.
+ if ( !loadImagePreview(img, url.path()) )
+ // Try to load with Qt/KDE.
+ img.load(url.path());
}
if (img.isNull())
@@ -214,6 +217,20 @@
}
}
+// -- Exif/IPTC preview extraction using Exiv2 --------------------------------------------------------
+
+bool kio_digikampreviewProtocol::loadImagePreview(QImage& image, const QString& path)
+{
+ DMetadata metadata(path);
+ if (metadata.getImagePreview(image))
+ {
+ kdDebug() << "Use Exif/Iptc preview extraction" << endl;
+ return true;
+ }
+
+ return false;
+}
+
// -- RAW preview extraction using Dcraw --------------------------------------------------------------
bool kio_digikampreviewProtocol::loadDCRAW(QImage& image, const QString& path)
@@ -269,7 +286,10 @@
if ( !imgData.isEmpty() )
{
if (image.loadFromData( imgData ))
+ {
+ kdDebug() << "Use embedded JPEG RAW preview extraction" << endl;
return true;
+ }
}
// In second, try to use simple RAW extraction method
@@ -311,7 +331,10 @@
if ( !imgData.isEmpty() )
{
if (image.loadFromData( imgData ))
+ {
+ kdDebug() << "Use reduced RAW preview extraction" << endl;
return true;
+ }
}
return false;
--- trunk/extragear/graphics/digikam/kioslave/digikampreview.h #553523:553524
@@ -43,6 +43,7 @@
void exifRotate(const QString& filePath, QImage& thumb);
bool loadDCRAW(QImage& image, const QString& path);
+ bool loadImagePreview(QImage& image, const QString& path);
};
More information about the Digikam-devel
mailing list