[gimp] plug-ins: trust the PSD's resolution over its metadata's resolution
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: trust the PSD's resolution over its metadata's resolution
- Date: Sun, 27 Oct 2013 18:01:50 +0000 (UTC)
commit 940d615218631a524c448e0537a8e7253e8e360d
Author: Michael Natterer <mitch gimp org>
Date: Sun Oct 27 19:01:22 2013 +0100
plug-ins: trust the PSD's resolution over its metadata's resolution
plug-ins/file-psd/psd-image-res-load.c | 4 +++-
plug-ins/file-psd/psd-image-res-load.h | 1 +
plug-ins/file-psd/psd-load.c | 8 ++++++--
plug-ins/file-psd/psd-load.h | 1 +
plug-ins/file-psd/psd.c | 7 ++++++-
5 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-image-res-load.c b/plug-ins/file-psd/psd-image-res-load.c
index 178b9dc..9691ff0 100644
--- a/plug-ins/file-psd/psd-image-res-load.c
+++ b/plug-ins/file-psd/psd-image-res-load.c
@@ -242,6 +242,7 @@ load_image_resource (PSDimageres *res_a,
const gint32 image_id,
PSDimage *img_a,
FILE *f,
+ gboolean *resolution_loaded,
GError **error)
{
gint pad;
@@ -289,7 +290,8 @@ load_image_resource (PSDimageres *res_a,
break;
case PSD_RESN_INFO:
- load_resource_1005 (res_a, image_id, f, error);
+ if (! load_resource_1005 (res_a, image_id, f, error))
+ *resolution_loaded = TRUE;
break;
case PSD_ALPHA_NAMES:
diff --git a/plug-ins/file-psd/psd-image-res-load.h b/plug-ins/file-psd/psd-image-res-load.h
index 5fefc2c..bce8604 100644
--- a/plug-ins/file-psd/psd-image-res-load.h
+++ b/plug-ins/file-psd/psd-image-res-load.h
@@ -30,6 +30,7 @@ gint load_image_resource (PSDimageres *res_a,
const gint32 image_id,
PSDimage *img_a,
FILE *f,
+ gboolean *resolution_loaded,
GError **error);
gint load_thumbnail_resource (PSDimageres *res_a,
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index bcea6f5..5c556d6 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -68,6 +68,7 @@ static gint add_color_map (const gint32 image_id,
static gint add_image_resources (const gint32 image_id,
PSDimage *img_a,
FILE *f,
+ gboolean *resolution_loaded,
GError **error);
static gint add_layers (const gint32 image_id,
@@ -109,6 +110,7 @@ static void convert_1_bit (const gchar *src,
/* Main file load function */
gint32
load_image (const gchar *filename,
+ gboolean *resolution_loaded,
GError **load_error)
{
FILE *f;
@@ -181,7 +183,7 @@ load_image (const gchar *filename,
/* ----- Add image resources ----- */
IFDBG(2) g_debug ("Add image resources");
- if (add_image_resources (image_id, &img_a, f, &error) < 0)
+ if (add_image_resources (image_id, &img_a, f, resolution_loaded, &error) < 0)
goto load_error;
gimp_progress_update (0.8);
@@ -966,6 +968,7 @@ static gint
add_image_resources (const gint32 image_id,
PSDimage *img_a,
FILE *f,
+ gboolean *resolution_loaded,
GError **error)
{
PSDimageres res_a;
@@ -998,7 +1001,8 @@ add_image_resources (const gint32 image_id,
return 0;
}
- if (load_image_resource (&res_a, image_id, img_a, f, error) < 0)
+ if (load_image_resource (&res_a, image_id, img_a, f,
+ resolution_loaded, error) < 0)
return -1;
}
diff --git a/plug-ins/file-psd/psd-load.h b/plug-ins/file-psd/psd-load.h
index 66117d4..177d74f 100644
--- a/plug-ins/file-psd/psd-load.h
+++ b/plug-ins/file-psd/psd-load.h
@@ -23,6 +23,7 @@
gint32 load_image (const gchar *filename,
+ gboolean *resolution_loaded,
GError **error);
diff --git a/plug-ins/file-psd/psd.c b/plug-ins/file-psd/psd.c
index 1eca3d4..ced1917 100644
--- a/plug-ins/file-psd/psd.c
+++ b/plug-ins/file-psd/psd.c
@@ -192,6 +192,7 @@ run (const gchar *name,
/* File load */
if (strcmp (name, LOAD_PROC) == 0)
{
+ gboolean resolution_loaded = FALSE;
gboolean interactive;
switch (run_mode)
@@ -206,7 +207,8 @@ run (const gchar *name,
break;
}
- image_ID = load_image (param[1].data.d_string, &error);
+ image_ID = load_image (param[1].data.d_string,
+ &resolution_loaded, &error);
if (image_ID != -1)
{
@@ -220,6 +222,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_ID, "image/x-psd",
metadata, flags,
interactive);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]