[Digikam-devel] extragear/graphics/digikam/libs/dimg/loaders

Gilles Caulier caulier.gilles at free.fr
Wed May 24 14:16:08 BST 2006


SVN commit 544316 by cgilles:

digikam from trunk : DIMg::TIFFLoader::save() bugfix : Always writting ICC profile tag before to write image data, else the result is impredictible (sometime icc profile is embedded, sometime no)...
CCMAIL: digikam-devel at kde.org, fj.cruz at supercable.es


 M  +1 -1      jpegloader.cpp  
 M  +1 -1      pngloader.cpp  
 M  +19 -20    tiffloader.cpp  


--- trunk/extragear/graphics/digikam/libs/dimg/loaders/jpegloader.cpp #544315:544316
@@ -484,7 +484,7 @@
     
     QByteArray profile_rawdata = imageICCProfil();
     
-    if (profile_rawdata.data() != 0)
+    if (!profile_rawdata.isEmpty())
     {
         write_icc_profile (&cinfo, (JOCTET *)profile_rawdata.data(), profile_rawdata.size());
     }    
--- trunk/extragear/graphics/digikam/libs/dimg/loaders/pngloader.cpp #544315:544316
@@ -592,7 +592,7 @@
     
     QByteArray profile_rawdata = imageICCProfil();
     
-    if (profile_rawdata.data() != 0)
+    if (!profile_rawdata.isEmpty())
     {
         png_set_iCCP(png_ptr, info_ptr, "icc", PNG_COMPRESSION_TYPE_BASE, profile_rawdata.data(), profile_rawdata.size());
     }    
--- trunk/extragear/graphics/digikam/libs/dimg/loaders/tiffloader.cpp #544315:544316
@@ -420,11 +420,27 @@
     TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, imageBitsDepth());
     TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tif, 0));
 
-    if (observer)
-        observer->progressInfo(m_image, 0.1);
+    // -------------------------------------------------------------------
+    // Write meta-data Tags contents.
+        
+    for (int t = DImg::TIF_TAG_ARTIST; t <= DImg::TIF_TAG_TARGETPRINTER; t++) 
+        setTiffTextTag(tif, t);
+    
+    // -------------------------------------------------------------------
+    // Write ICC profil.
+    
+    QByteArray profile_rawdata = imageICCProfil();
+    
+    if (!profile_rawdata.isEmpty())
+    {
+        TIFFSetField (tif, TIFFTAG_ICCPROFILE, (uint32)profile_rawdata.size(), (uchar *)profile_rawdata.data());
+    }    
 
     // -------------------------------------------------------------------
     // Write image data
+
+    if (observer)
+        observer->progressInfo(m_image, 0.1);
     
     uint8  *buf=0;
     uchar  *pixel;
@@ -536,26 +552,9 @@
     }
 
     _TIFFfree(buf);
-    
-    // -------------------------------------------------------------------
-    // Write meta-data Tags contents.
-        
-    for (int t = DImg::TIF_TAG_ARTIST; t <= DImg::TIF_TAG_TARGETPRINTER; t++) 
-        setTiffTextTag(tif, t);
+    TIFFClose(tif);
 
     // -------------------------------------------------------------------
-    // Write ICC profil.
-    
-    QByteArray profile_rawdata = imageICCProfil();
-    
-    if (profile_rawdata.data() != 0)
-    {
-        TIFFSetField (tif, TIFFTAG_ICCPROFILE, (uint32)profile_rawdata.size(), (uchar *)profile_rawdata.data());
-    }    
-    
-    // -------------------------------------------------------------------
-        
-    TIFFClose(tif);
 
     if (observer)
         observer->progressInfo(m_image, 1.0);



More information about the Digikam-devel mailing list