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

This commit is contained in:
Michael Natterer 2013-10-27 18:40:09 +01:00
parent 658d950c6b
commit c8fae1957f
1 changed files with 10 additions and 0 deletions

View File

@ -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;
}
}