[Kde-imaging] kdeextragear-libs-1/kipi-plugins/imagesgallery

Gilles Caulier caulier.gilles at free.fr
Fri Sep 24 15:50:00 CEST 2004


CVS commit by cgilles: 

Fixed bug #88939:
- Resizing images have no effect if no resize images option enable.
- JPEG exif data stored to the JPEG target images.
CCMAIL: kde-imaging at kde.org, digikam-users at lists.sourceforge.net


  A            exifrestorer.cpp   1.1 [GPL]
  A            exifrestorer.h   1.1 [GPL]
  A            jpegsection.h   1.1 [GPL]
  M +1 -1      Makefile.am   1.9
  M +70 -41    imagesgallery.cpp   1.30


--- kdeextragear-libs-1/kipi-plugins/imagesgallery/Makefile.am  #1.8:1.9
@@ -7,5 +7,5 @@
 # Srcs for the plugin
 kipiplugin_imagesgallery_la_SOURCES = plugin_imagesgallery.cpp imgallerydialog.cpp \
-                                      imagesgallery.cpp 
+                                      imagesgallery.cpp exifrestorer.cpp 
 
 # Libs needed by the plugin

--- kdeextragear-libs-1/kipi-plugins/imagesgallery/imagesgallery.cpp  #1.29:1.30
@@ -68,4 +68,10 @@ extern "C"
 #include <kaboutdata.h>
 
+// LibKExif includes.
+
+/*#include <libkexif/kexif.h>
+#include <libkexif/kexifdata.h>
+#include <libkexif/kexifutils.h>
+*/
 // KIPI includes
 
@@ -76,4 +82,5 @@ extern "C"
 #include "actions.h"
 #include "imgallerydialog.h"
+#include "exifrestorer.h"
 #include "imagesgallery.h"
 
@@ -1454,5 +1461,5 @@ int ImagesGallery::createThumb( const KU
     m_targetImgHeight = 480;
 
-    ResizeImage(pixPath, TargetImagesbDir, TargetimagesFormat, TargetImageNameFormat,
+    int valRet = ResizeImage(pixPath, TargetImagesbDir, TargetimagesFormat, TargetImageNameFormat,
                      &m_targetImgWidth, &m_targetImgHeight, extentTargetImages,
                      m_colorDepthSetTargetImages,
@@ -1461,4 +1468,26 @@ int ImagesGallery::createThumb( const KU
                      m_targetImagesCompression);
 
+    // Only try to write Exif if both src and destination are JPEG files.
+    
+    if (valRet == 1 && 
+        QString(QImageIO::imageFormat(pixPath)).upper() == "JPEG" &&
+        TargetimagesFormat.upper() == "JPEG")
+       {
+       ExifRestorer exifHolder;
+       exifHolder.readFile(pixPath, ExifRestorer::ExifOnly);
+       
+       QString targetFile = TargetImagesbDir + TargetImageNameFormat;
+       
+       if (exifHolder.hasExif()) 
+          {
+          ExifRestorer restorer;
+          restorer.readFile(targetFile, ExifRestorer::EntireImage);
+          restorer.insertExifData(exifHolder.exifData());
+          restorer.writeFile(targetFile);
+          }
+       else 
+          kdWarning( 51000 ) << ("createThumb::No Exif Data Found") << endl;
+       }              
+                     
     // Create the thumbnails.
 
@@ -1509,7 +1538,6 @@ int ImagesGallery::ResizeImage( const QS
        int h = img.height();
 
-       if (SizeFactor == -1)      // Use original image size.
-            SizeFactor=w;
-
+       if (SizeFactor != -1)      // Use original image size ?
+          {
        // scale to pixie size
        // kdDebug( 51000 ) << "w: " << w << " h: " << h << endl;
@@ -1546,4 +1574,5 @@ int ImagesGallery::ResizeImage( const QS
 
            img = scaleImg;
+              }
 
            if ( ColorDepthChange == true )




More information about the Kde-imaging mailing list