[gimp] plug-ins: trust the TIFF's resolution over its metadata's resolution



commit c8fae1957f667acd41a8ad5bb29c2662d1c8aa2f
Author: Michael Natterer <mitch gimp org>
Date:   Sun Oct 27 18:40:09 2013 +0100

    plug-ins: trust the TIFF's resolution over its metadata's resolution

 plug-ins/common/file-tiff-load.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/common/file-tiff-load.c b/plug-ins/common/file-tiff-load.c
index 2f21d06..5a694b0 100644
--- a/plug-ins/common/file-tiff-load.c
+++ b/plug-ins/common/file-tiff-load.c
@@ -114,6 +114,7 @@ static gboolean  load_dialog      (TIFF               *tif,
 static gint32    load_image       (const gchar        *filename,
                                    TIFF               *tif,
                                    TiffSelectedPages  *pages,
+                                   gboolean           *resolution_loaded,
                                    GError            **error);
 
 static void      load_rgba        (TIFF         *tif,
@@ -271,9 +272,12 @@ run (const gchar      *name,
 
               if (run_it)
                 {
+                  gboolean resolution_loaded = FALSE;
+
                   gimp_set_data (LOAD_PROC, &target, sizeof (target));
 
                   image = load_image (param[1].data.d_string, tif, &pages,
+                                      &resolution_loaded,
                                       &error);
 
                   g_free (pages.pages);
@@ -291,6 +295,9 @@ run (const gchar      *name,
                         {
                           GimpMetadataLoadFlags flags = GIMP_METADATA_LOAD_ALL;
 
+                          if (resolution_loaded)
+                            flags &= ~GIMP_METADATA_LOAD_RESOLUTION;
+
                           gimp_image_metadata_load_finish (image, "image/tiff",
                                                            metadata, flags,
                                                            run_mode == GIMP_RUN_INTERACTIVE);
@@ -524,6 +531,7 @@ static gint32
 load_image (const gchar        *filename,
             TIFF               *tif,
             TiffSelectedPages  *pages,
+            gboolean           *resolution_loaded,
             GError            **error)
 {
   gushort       bps, spp, photomet;
@@ -957,6 +965,8 @@ load_image (const gchar        *filename,
                 gimp_image_set_resolution (image, xres, yres);
                 if (unit != GIMP_UNIT_PIXEL)
                   gimp_image_set_unit (image, unit);
+
+                *resolution_loaded = TRUE;
               }
           }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]