[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/digikam/libs
From:       Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date:       2009-09-13 16:20:30
Message-ID: 1252858830.278218.3054.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1022965 by mwiesweg:

Move the code to read an Icc profile from Exif from DImgLoader to DMetadata

 M  +1 -27     dimg/loaders/dimgloader.cpp  
 M  +32 -0     dmetadata/dmetadata.cpp  
 M  +8 -0      dmetadata/dmetadata.h  


--- trunk/extragear/graphics/digikam/libs/dimg/loaders/dimgloader.cpp #1022964:1022965
@@ -205,38 +205,12 @@
 {
     DMetadata metaData;
     metaData.setExif(m_image->getExif());
-
-    // Check if Exif data contains an ICC color profile.
-    QByteArray profile = metaData.getExifTagData("Exif.Image.InterColorProfile");
+    IccProfile profile = metaData.getIccProfile();
     if (!profile.isNull())
     {
-        kDebug(50003) << "Found an ICC profile in Exif metadata";
         m_image->setIccProfile(profile);
         return true;
     }
-
-    // Else check the Exif color-space tag and use a default profiles available with libkdcraw.
-
-    switch(metaData.getImageColorWorkSpace())
-    {
-        case DMetadata::WORKSPACE_SRGB:
-        {
-            kDebug(50003) << "Exif color-space tag is sRGB. Using default sRGB ICC profile.";
-            m_image->setIccProfile(IccProfile::sRGB());
-            return true;
-        }
-
-        case DMetadata::WORKSPACE_ADOBERGB:
-        {
-            kDebug(50003) << "Exif color-space tag is AdobeRGB. Using default AdobeRGB ICC profile.";
-            m_image->setIccProfile(IccProfile::adobeRGB());
-            return true;
-        }
-
-        default:
-            break;
-    }
-
     return false;
 }
 
--- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp #1022964:1022965
@@ -982,6 +982,38 @@
     return lens;
 }
 
+IccProfile DMetadata::getIccProfile() const
+{
+    // Check if Exif data contains an ICC color profile.
+    QByteArray data = getExifTagData("Exif.Image.InterColorProfile");
+    if (!data.isNull())
+    {
+        kDebug(50003) << "Found an ICC profile in Exif metadata";
+        return data;
+    }
+
+    // Else check the Exif color-space tag and use default profiles that we ship
+    switch (getImageColorWorkSpace())
+    {
+        case DMetadata::WORKSPACE_SRGB:
+        {
+            kDebug(50003) << "Exif color-space tag is sRGB. Using default sRGB ICC profile.";
+            return IccProfile::sRGB();
+        }
+
+        case DMetadata::WORKSPACE_ADOBERGB:
+        {
+            kDebug(50003) << "Exif color-space tag is AdobeRGB. Using default AdobeRGB ICC profile.";
+            return IccProfile::adobeRGB();
+        }
+
+        default:
+            break;
+    }
+
+    return IccProfile();
+}
+
 bool DMetadata::setIptcTag(const QString& text, int maxLength,
                            const char* debugLabel, const char* tagKey)  const
 {
--- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.h #1022964:1022965
@@ -46,6 +46,7 @@
 namespace Digikam
 {
 class Template;
+class IccProfile;
 
 class DIGIKAM_EXPORT DMetadata : public KExiv2Iface::KExiv2
 {
@@ -97,6 +98,13 @@
      */
     QString getLensDescription() const;
 
+    /** Reads an IccProfile that is described or embedded in the metadata.
+        This method does retrieve profiles embedded in the image but not the metadata,
+        e.g. embedded profiles in JPEG images.
+        Returns a null profile if no profile is found.
+     */
+    IccProfile getIccProfile() const;
+
     PhotoInfoContainer getPhotographInformation() const;
 
     /** Returns the requested metadata field as a QVariant. See metadatainfo.h for a specification
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic