plug-ins: return image type and #layers from the JPEG thumbnail procedure

This commit is contained in:
Michael Natterer
2012-04-11 21:48:22 +02:00
parent 9dd119c871
commit f888792a77
3 changed files with 24 additions and 14 deletions

View File

@ -653,10 +653,11 @@ term_source (j_decompress_ptr cinfo)
}
gint32
load_thumbnail_image (const gchar *filename,
gint *width,
gint *height,
GError **error)
load_thumbnail_image (const gchar *filename,
gint *width,
gint *height,
GimpImageType *type,
GError **error)
{
gint32 volatile image_ID;
ExifData *exif_data;
@ -952,6 +953,8 @@ load_thumbnail_image (const gchar *filename,
jpeg_exif_rotate (image_ID, orientation);
*type = layer_type;
return image_ID;
}

View File

@ -26,10 +26,11 @@ gint32 load_image (const gchar *filename,
#ifdef HAVE_LIBEXIF
gint32 load_thumbnail_image (const gchar *filename,
gint *width,
gint *height,
GError **error);
gint32 load_thumbnail_image (const gchar *filename,
gint *width,
gint *height,
GimpImageType *type,
GError **error);
#endif /* HAVE_LIBEXIF */

View File

@ -191,7 +191,7 @@ run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[4];
static GimpParam values[6];
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID;
@ -257,21 +257,27 @@ run (const gchar *name,
}
else
{
const gchar *filename = param[0].data.d_string;
gint width = 0;
gint height = 0;
const gchar *filename = param[0].data.d_string;
gint width = 0;
gint height = 0;
GimpImageType type = -1;
image_ID = load_thumbnail_image (filename, &width, &height, &error);
image_ID = load_thumbnail_image (filename, &width, &height, &type,
&error);
if (image_ID != -1)
{
*nreturn_vals = 4;
*nreturn_vals = 6;
values[1].type = GIMP_PDB_IMAGE;
values[1].data.d_image = image_ID;
values[2].type = GIMP_PDB_INT32;
values[2].data.d_int32 = width;
values[3].type = GIMP_PDB_INT32;
values[3].data.d_int32 = height;
values[4].type = GIMP_PDB_INT32;
values[4].data.d_int32 = type;
values[5].type = GIMP_PDB_INT32;
values[5].data.d_int32 = 1; /* num_layers */
}
else
{