[Digikam-devel] branches/stable/extragear/graphics/digikam/utilities/imageeditor

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] branches/stable/extragear/graphics/digikam/utilities/imageeditor

Gilles Caulier
SVN commit 530992 by cgilles:

digikam from stable : image editor imlib2 interface: to detect image file format, we parse file extension in first, and in second, we parse file header.

This way is mandatory because some TIFF files are detected like RAW files by dcraw::parse method.

Please, update svn and give me a feedback (:=)))...
 
CCMAIL:  [hidden email], [hidden email], [hidden email]

 M  +21 -0     imlibinterface.cpp  


--- branches/stable/extragear/graphics/digikam/utilities/imageeditor/imlibinterface.cpp #530991:530992
@@ -175,6 +175,27 @@
 {
     if ( filePath == QString::null )
         return NONE_IMAGE;
+
+    // In first we trying to check the file extension. This is mandatory because
+    // some tiff files are detected like RAW files by dcraw::parse method.
+
+    QFileInfo fileInfo(filePath);
+    if (!fileInfo.exists())
+    {
+        kdDebug() << k_funcinfo << "Failed to open file" << endl;
+        return NONE_IMAGE;
+    }
+    
+    QString ext = fileInfo.extension().upper();
+
+    if (ext == QString("JPEG") || ext == QString("JPG"))
+        return JPEG_IMAGE;
+    else if (ext == QString("PNG"))
+        return PNG_IMAGE;
+    else if (ext == QString("TIFF") || ext == QString("TIF"))
+        return TIFF_IMAGE;
+
+    // In second, we trying to parse file header.
         
     FILE* f = fopen(QFile::encodeName(filePath), "rb");
     
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel