[gimp/gimp-attributes-wip: 3/6] restore more old GimpMetadata API restore xcf-functions restore file-load/save functions
- From: Hartmut Kuhse <hartmutkuhse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-attributes-wip: 3/6] restore more old GimpMetadata API restore xcf-functions restore file-load/save functions
- Date: Sun, 13 Nov 2016 06:42:38 +0000 (UTC)
commit b49e1a21f8e974ebfdf562cb35f97e715ab8e213
Author: Hartmut Kuhse <hk_priv gmx de>
Date: Sun Nov 13 07:14:23 2016 +0100
restore more old GimpMetadata API
restore xcf-functions
restore file-load/save functions
app/core/gimpimage-metadata.c | 93 +++++---------
app/core/gimpimage-metadata.h | 4 +
app/xcf/xcf-load.c | 50 +++++---
app/xcf/xcf-save.c | 24 ++++-
libgimpbase/gimpbase.def | 2 +
libgimpbase/gimpmetadata.c | 284 ++++++++++++++++++++++++++++++++++++++++
plug-ins/common/file-png.c | 19 +--
plug-ins/file-exr/file-exr.c | 11 +--
plug-ins/file-psd/psd.c | 12 +-
plug-ins/file-tiff/file-tiff.c | 24 ++--
10 files changed, 406 insertions(+), 117 deletions(-)
---
diff --git a/app/core/gimpimage-metadata.c b/app/core/gimpimage-metadata.c
index c244952..dc18f34 100644
--- a/app/core/gimpimage-metadata.c
+++ b/app/core/gimpimage-metadata.c
@@ -33,66 +33,39 @@
/* public functions */
-//void
-//gimp_image_set_metadata (GimpImage *image,
-// GimpMetadata *metadata,
-// gboolean push_undo)
-//{
-// GimpImagePrivate *private;
-//
-// g_return_if_fail (GIMP_IS_IMAGE (image));
-//
-// private = GIMP_IMAGE_GET_PRIVATE (image);
-//
-// if (metadata != private->metadata)
-// {
-// if (push_undo)
-// gimp_image_undo_push_image_metadata (image, NULL);
-//
-// if (private->metadata)
-// g_object_unref (private->metadata);
-//
-// private->metadata = metadata;
-//
-// if (private->metadata)
-// {
-// gdouble xres, yres;
-//
-// g_object_ref (private->metadata);
-//
-// gimp_metadata_set_pixel_size (metadata,
-// gimp_image_get_width (image),
-// gimp_image_get_height (image));
-//
-// switch (gimp_image_get_component_type (image))
-// {
-// case GIMP_COMPONENT_TYPE_U8:
-// gimp_metadata_set_bits_per_sample (metadata, 8);
-// break;
-//
-// case GIMP_COMPONENT_TYPE_U16:
-// case GIMP_COMPONENT_TYPE_HALF:
-// gimp_metadata_set_bits_per_sample (metadata, 16);
-// break;
-//
-// case GIMP_COMPONENT_TYPE_U32:
-// case GIMP_COMPONENT_TYPE_FLOAT:
-// gimp_metadata_set_bits_per_sample (metadata, 32);
-// break;
-//
-// case GIMP_COMPONENT_TYPE_DOUBLE:
-// gimp_metadata_set_bits_per_sample (metadata, 64);
-// break;
-// }
-//
-// gimp_image_get_resolution (image, &xres, &yres);
-// gimp_metadata_set_resolution (metadata, xres, yres,
-// gimp_image_get_unit (image));
-// }
-//
-// g_object_notify (G_OBJECT (image), "metadata");
-// }
-//}
+GimpMetadata *
+gimp_image_get_metadata (GimpImage *image)
+{
+ GimpAttributes *attributes = NULL;
+ GimpMetadata *metadata = NULL;
+
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+
+ attributes = gimp_image_get_attributes (image);
+ if (attributes)
+ {
+ metadata = gimp_metadata_new ();
+ gimp_attributes_to_metadata (attributes,
+ metadata,
+ "image/any");
+ }
+ return metadata;
+}
+
+void
+gimp_image_set_metadata (GimpImage *image,
+ GimpMetadata *metadata,
+ gboolean push_undo)
+{
+ GimpAttributes *attributes = NULL;
+
+ attributes = gimp_attributes_from_metadata (NULL, metadata);
+
+ gimp_image_set_attributes (image,
+ attributes,
+ push_undo);
+ g_object_unref (attributes);
+}
void
gimp_image_set_attributes (GimpImage *image,
diff --git a/app/core/gimpimage-metadata.h b/app/core/gimpimage-metadata.h
index 77bb083..aa2beb2 100644
--- a/app/core/gimpimage-metadata.h
+++ b/app/core/gimpimage-metadata.h
@@ -19,6 +19,10 @@
#define __GIMP_IMAGE_METADATA_H__
+GimpMetadata * gimp_image_get_metadata (GimpImage *image);
+void gimp_image_set_metadata (GimpImage *image,
+ GimpMetadata *metadata,
+ gboolean push_undo);
void gimp_image_set_attributes (GimpImage *image,
GimpAttributes *attributes,
gboolean push_undo);
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 0d5b6b9..1b7c152 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -246,37 +246,53 @@ xcf_load_image (Gimp *gimp,
}
}
- /* check for an attributes parasite */
+ /* check for a metadata parasite */
parasite = gimp_image_parasite_find (GIMP_IMAGE (image),
- "gimp-image-attributes");
+ "gimp-image-metadata");
if (parasite)
{
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
- GimpAttributes *attributes;
- const gchar *attributes_string;
+ GimpMetadata *metadata;
+ const gchar *meta_string;
- attributes_string = (gchar *) gimp_parasite_data (parasite);
- attributes = gimp_attributes_deserialize (attributes_string);
+ meta_string = (gchar *) gimp_parasite_data (parasite);
+ metadata = gimp_metadata_deserialize (meta_string);
- if (attributes)
+ if (metadata)
{
- gimp_image_set_attributes (image, attributes, FALSE);
- g_object_unref (attributes);
+ has_metadata = TRUE;
+
+ gimp_image_set_metadata (image, metadata, FALSE);
+ g_object_unref (metadata);
}
gimp_parasite_list_remove (private->parasites,
gimp_parasite_name (parasite));
}
-
- /* check for a metadata parasite */
- parasite = gimp_image_parasite_find (GIMP_IMAGE (image),
- "gimp-image-metadata");
- if (parasite)
+ else
{
- GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
- gimp_parasite_list_remove (private->parasites,
- gimp_parasite_name (parasite));
+ /* check for an attributes parasite */
+ parasite = gimp_image_parasite_find (GIMP_IMAGE (image),
+ "gimp-image-attributes");
+ if (parasite)
+ {
+ GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
+ GimpAttributes *attributes;
+ const gchar *attributes_string;
+
+ attributes_string = (gchar *) gimp_parasite_data (parasite);
+ attributes = gimp_attributes_deserialize (attributes_string);
+
+ if (attributes)
+ {
+ gimp_image_set_attributes (image, attributes, FALSE);
+ g_object_unref (attributes);
+ }
+
+ gimp_parasite_list_remove (private->parasites,
+ gimp_parasite_name (parasite));
+ }
}
/* migrate the old "exif-data" parasite */
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 07b4bae..cc62176 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -341,7 +341,6 @@ xcf_save_image_props (XcfInfo *info,
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
GimpParasite *grid_parasite = NULL;
GimpParasite *meta_parasite = NULL;
- GimpParasite *attributes_parasite = NULL;
GimpParasite *compat_parasite = NULL;
GimpUnit unit = gimp_image_get_unit (image);
gdouble xres;
@@ -395,8 +394,10 @@ xcf_save_image_props (XcfInfo *info,
gimp_parasite_list_add (private->parasites, grid_parasite);
}
+#if 0
if (gimp_image_get_attributes (image))
{
+ GimpParasite *attributes_parasite = NULL;
GimpAttributes *attributes = gimp_image_get_attributes (image);
gchar *attributes_string;
@@ -412,6 +413,25 @@ xcf_save_image_props (XcfInfo *info,
g_free (attributes_string);
}
}
+#endif
+
+ if (gimp_image_get_metadata (image))
+ {
+ GimpMetadata *metadata = gimp_image_get_metadata (image);
+ gchar *meta_string;
+
+ meta_string = gimp_metadata_serialize (metadata);
+
+ if (meta_string)
+ {
+ meta_parasite = gimp_parasite_new ("gimp-image-metadata",
+ GIMP_PARASITE_PERSISTENT,
+ strlen (meta_string) + 1,
+ meta_string);
+ gimp_parasite_list_add (private->parasites, meta_parasite);
+ g_free (meta_string);
+ }
+ }
if (gimp_image_get_xcf_compat_mode (image))
{
@@ -604,6 +624,7 @@ xcf_save_channel_props (XcfInfo *info,
guchar col[3];
GimpParasite *attributes_parasite = NULL;
+#if 0
if (gimp_item_get_attributes (GIMP_ITEM (channel)))
{
GimpAttributes *attributes = gimp_item_get_attributes (GIMP_ITEM (channel));
@@ -621,6 +642,7 @@ xcf_save_channel_props (XcfInfo *info,
g_free (attributes_string);
}
}
+#endif
if (channel == gimp_image_get_active_channel (image))
xcf_check_error (xcf_save_prop (info, image, PROP_ACTIVE_CHANNEL, error));
diff --git a/libgimpbase/gimpbase.def b/libgimpbase/gimpbase.def
index 97b344c..e1e28e0 100644
--- a/libgimpbase/gimpbase.def
+++ b/libgimpbase/gimpbase.def
@@ -117,12 +117,14 @@ EXPORTS
gimp_memsize_to_string
gimp_merge_type_get_type
gimp_message_handler_type_get_type
+ gimp_metadata_deserialize
gimp_metadata_get_colorspace
gimp_metadata_get_resolution
gimp_metadata_is_tag_supported
gimp_metadata_load_from_file
gimp_metadata_new
gimp_metadata_save_to_file
+ gimp_metadata_serialize
gimp_metadata_set_bits_per_sample
gimp_metadata_set_colorspace
gimp_metadata_set_from_exif
diff --git a/libgimpbase/gimpmetadata.c b/libgimpbase/gimpmetadata.c
index 74ec71b..7d69708 100644
--- a/libgimpbase/gimpmetadata.c
+++ b/libgimpbase/gimpmetadata.c
@@ -178,6 +178,290 @@ typedef struct
GimpMetadata *metadata;
} GimpMetadataParseData;
+static const gchar*
+gimp_metadata_attribute_name_to_value (const gchar **attribute_names,
+ const gchar **attribute_values,
+ const gchar *name)
+{
+ while (*attribute_names)
+ {
+ if (! strcmp (*attribute_names, name))
+ {
+ return *attribute_values;
+ }
+
+ attribute_names++;
+ attribute_values++;
+ }
+
+ return NULL;
+}
+
+static void
+gimp_metadata_deserialize_start_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error)
+{
+ GimpMetadataParseData *parse_data = user_data;
+
+ if (! strcmp (element_name, "tag"))
+ {
+ const gchar *name;
+ const gchar *encoding;
+
+ name = gimp_metadata_attribute_name_to_value (attribute_names,
+ attribute_values,
+ "name");
+ encoding = gimp_metadata_attribute_name_to_value (attribute_names,
+ attribute_values,
+ "encoding");
+
+ if (! name)
+ {
+ g_set_error (error, gimp_metadata_error_quark (), 1001,
+ "Element 'tag' does not contain required attribute 'name'.");
+ return;
+ }
+
+ strncpy (parse_data->name, name, sizeof (parse_data->name));
+ parse_data->name[sizeof (parse_data->name) - 1] = 0;
+
+ parse_data->base64 = (encoding && ! strcmp (encoding, "base64"));
+ }
+}
+
+static void
+gimp_metadata_deserialize_end_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error)
+{
+}
+
+static void
+gimp_metadata_deserialize_text (GMarkupParseContext *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error)
+{
+ GimpMetadataParseData *parse_data = user_data;
+ const gchar *current_element;
+
+ current_element = g_markup_parse_context_get_element (context);
+
+ if (! g_strcmp0 (current_element, "tag"))
+ {
+ gchar *value = g_strndup (text, text_len);
+
+ if (parse_data->base64)
+ {
+ guchar *decoded;
+ gsize len;
+
+ decoded = g_base64_decode (value, &len);
+
+ if (decoded[len - 1] == '\0')
+ gexiv2_metadata_set_tag_string (parse_data->metadata,
+ parse_data->name,
+ (const gchar *) decoded);
+
+ g_free (decoded);
+ }
+ else
+ {
+ gexiv2_metadata_set_tag_string (parse_data->metadata,
+ parse_data->name,
+ value);
+ }
+
+ g_free (value);
+ }
+}
+
+static void
+gimp_metadata_deserialize_error (GMarkupParseContext *context,
+ GError *error,
+ gpointer user_data)
+{
+ g_printerr ("Metadata parse error: %s\n", error->message);
+}
+
+/**
+ * gimp_metadata_deserialize:
+ * @metadata_xml: A string of serialized metadata XML.
+ *
+ * Deserializes a string of XML that has been created by
+ * gimp_metadata_serialize().
+ *
+ * Return value: The new #GimpMetadata.
+ *
+ * Since: 2.10
+ */
+GimpMetadata *
+gimp_metadata_deserialize (const gchar *metadata_xml)
+{
+ GimpMetadata *metadata;
+ GMarkupParser markup_parser;
+ GimpMetadataParseData parse_data;
+ GMarkupParseContext *context;
+
+ g_return_val_if_fail (metadata_xml != NULL, NULL);
+
+ metadata = gimp_metadata_new ();
+
+ parse_data.metadata = metadata;
+
+ markup_parser.start_element = gimp_metadata_deserialize_start_element;
+ markup_parser.end_element = gimp_metadata_deserialize_end_element;
+ markup_parser.text = gimp_metadata_deserialize_text;
+ markup_parser.passthrough = NULL;
+ markup_parser.error = gimp_metadata_deserialize_error;
+
+ context = g_markup_parse_context_new (&markup_parser, 0, &parse_data, NULL);
+
+ g_markup_parse_context_parse (context,
+ metadata_xml, strlen (metadata_xml),
+ NULL);
+
+ g_markup_parse_context_unref (context);
+
+ return metadata;
+}
+
+static gchar *
+gimp_metadata_escape (const gchar *name,
+ const gchar *value,
+ gboolean *base64)
+{
+ if (! g_utf8_validate (value, -1, NULL))
+ {
+ gchar *encoded;
+
+ encoded = g_base64_encode ((const guchar *) value, strlen (value) + 1);
+
+ g_printerr ("Invalid UTF-8 in metadata value %s, encoding as base64: %s\n",
+ name, encoded);
+
+ *base64 = TRUE;
+
+ return encoded;
+ }
+
+ *base64 = FALSE;
+
+ return g_markup_escape_text (value, -1);
+}
+
+static void
+gimp_metadata_append_tag (GString *string,
+ const gchar *name,
+ gchar *value,
+ gboolean base64)
+{
+ if (value)
+ {
+ if (base64)
+ {
+ g_string_append_printf (string, " <tag name=\"%s\" encoding=\"base64\">%s</tag>\n",
+ name, value);
+ }
+ else
+ {
+ g_string_append_printf (string, " <tag name=\"%s\">%s</tag>\n",
+ name, value);
+ }
+
+ g_free (value);
+ }
+}
+
+/**
+ * gimp_metadata_serialize:
+ * @metadata: A #GimpMetadata instance.
+ *
+ * Serializes @metadata into an XML string that can later be deserialized
+ * using gimp_metadata_deserialize().
+ *
+ * Return value: The serialized XML string.
+ *
+ * Since: 2.10
+ */
+gchar *
+gimp_metadata_serialize (GimpMetadata *metadata)
+{
+ GString *string;
+ gchar **exif_data = NULL;
+ gchar **iptc_data = NULL;
+ gchar **xmp_data = NULL;
+ gchar *value;
+ gchar *escaped;
+ gboolean base64;
+ gint i;
+
+ g_return_val_if_fail (GEXIV2_IS_METADATA (metadata), NULL);
+
+ string = g_string_new (NULL);
+
+ g_string_append (string, "<?xml version='1.0' encoding='UTF-8'?>\n");
+ g_string_append (string, "<metadata>\n");
+
+ exif_data = gexiv2_metadata_get_exif_tags (metadata);
+
+ if (exif_data)
+ {
+ for (i = 0; exif_data[i] != NULL; i++)
+ {
+ value = gexiv2_metadata_get_tag_string (metadata, exif_data[i]);
+ escaped = gimp_metadata_escape (exif_data[i], value, &base64);
+ g_free (value);
+
+ gimp_metadata_append_tag (string, exif_data[i], escaped, base64);
+ }
+
+ g_strfreev (exif_data);
+ }
+
+ xmp_data = gexiv2_metadata_get_xmp_tags (metadata);
+
+ if (xmp_data)
+ {
+ for (i = 0; xmp_data[i] != NULL; i++)
+ {
+ value = gexiv2_metadata_get_tag_string (metadata, xmp_data[i]);
+ escaped = gimp_metadata_escape (xmp_data[i], value, &base64);
+ g_free (value);
+
+ gimp_metadata_append_tag (string, xmp_data[i], escaped, base64);
+ }
+
+ g_strfreev (xmp_data);
+ }
+
+ iptc_data = gexiv2_metadata_get_iptc_tags (metadata);
+
+ if (iptc_data)
+ {
+ for (i = 0; iptc_data[i] != NULL; i++)
+ {
+ value = gexiv2_metadata_get_tag_string (metadata, iptc_data[i]);
+ escaped = gimp_metadata_escape (iptc_data[i], value, &base64);
+ g_free (value);
+
+ gimp_metadata_append_tag (string, iptc_data[i], escaped, base64);
+ }
+
+ g_strfreev (iptc_data);
+ }
+
+ g_string_append (string, "</metadata>\n");
+
+ return g_string_free (string, FALSE);
+}
+
/**
* gimp_metadata_load_from_file:
* @file: The #GFile to load the metadata from
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index ab8ab35..fc34fbb 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -493,7 +493,7 @@ run (const gchar *name,
strcmp (name, SAVE2_PROC) == 0 ||
strcmp (name, SAVE_DEFAULTS_PROC) == 0)
{
- GimpAttributes *attributes;
+ GimpMetadata *metadata;
GimpMetadataSaveFlags metadata_flags;
gint32 orig_image_ID;
gint bits_depth;
@@ -529,7 +529,7 @@ run (const gchar *name,
break;
}
- attributes = gimp_image_metadata_save_prepare (orig_image_ID,
+ metadata = gimp_image_metadata_save_prepare (orig_image_ID,
"image/png",
&metadata_flags);
@@ -615,17 +615,11 @@ run (const gchar *name,
if (save_image (param[3].data.d_string,
image_ID, drawable_ID, orig_image_ID, &bits_depth, &error))
{
- if (attributes)
+ if (metadata)
{
GFile *file;
- gchar *val = g_strdup_printf ("%u", (gushort) bits_depth);
- gimp_attributes_add_attribute (attributes,
- gimp_attribute_new_string ("Exif.Image.BitsPerSample",
- val, TYPE_SHORT)
- );
-
- g_free (val);
+ gimp_metadata_set_bits_per_sample (metadata, 8);
if (pngvals.save_exif)
metadata_flags |= GIMP_METADATA_SAVE_EXIF;
@@ -648,11 +642,12 @@ run (const gchar *name,
metadata_flags &= ~GIMP_METADATA_SAVE_THUMBNAIL;
file = g_file_new_for_path (param[3].data.d_string);
+
gimp_image_metadata_save_finish (orig_image_ID,
"image/png",
- attributes, metadata_flags,
+ metadata, metadata_flags,
file, NULL);
- g_object_unref (attributes);
+ g_object_unref (metadata);
g_object_unref (file);
}
diff --git a/plug-ins/file-exr/file-exr.c b/plug-ins/file-exr/file-exr.c
index 41b2392..9e590f1 100644
--- a/plug-ins/file-exr/file-exr.c
+++ b/plug-ins/file-exr/file-exr.c
@@ -175,7 +175,6 @@ load_image (const gchar *filename,
gint32 success = FALSE;
gchar *comment;
GimpMetadata *metadata = NULL;
- GimpAttributes *attributes = NULL;
gboolean have_metadata = FALSE;
guchar *exif_data;
guint exif_size;
@@ -330,11 +329,7 @@ load_image (const gchar *filename,
g_free (comment);
}
- attributes = gimp_image_get_attributes (image);
- if (!attributes)
- attributes = gimp_attributes_new ();
-
- gimp_attributes_to_metadata (attributes, metadata, "image/x-exr");
+ metadata = gimp_image_get_metadata (image);
if (metadata)
g_object_ref (metadata);
@@ -373,9 +368,7 @@ load_image (const gchar *filename,
if (have_metadata)
{
- gimp_attributes_from_metadata (attributes, metadata);
- gimp_image_set_attributes (image, attributes);
- g_object_unref (attributes);
+ gimp_image_set_metadata (image, metadata);
}
g_object_unref (metadata);
diff --git a/plug-ins/file-psd/psd.c b/plug-ins/file-psd/psd.c
index e17af1c..f8cb84f 100644
--- a/plug-ins/file-psd/psd.c
+++ b/plug-ins/file-psd/psd.c
@@ -262,7 +262,7 @@ run (const gchar *name,
else if (strcmp (name, SAVE_PROC) == 0)
{
gint32 drawable_id;
- GimpAttributes *attributes;
+ GimpMetadata *metadata;
GimpMetadataSaveFlags metadata_flags;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
@@ -297,26 +297,26 @@ run (const gchar *name,
break;
}
- attributes = gimp_image_metadata_save_prepare (image_ID,
+ metadata = gimp_image_metadata_save_prepare (image_ID,
"image/x-psd",
&metadata_flags);
if (save_image (param[3].data.d_string, image_ID, &error))
{
- if (attributes)
+ if (metadata)
{
GFile *file;
- gimp_attributes_new_attribute (attributes, "Exif.Image.BitsPerSample", "8", TYPE_SHORT);
+ gimp_metadata_set_bits_per_sample (metadata, 8);
file = g_file_new_for_path (param[3].data.d_string);
gimp_image_metadata_save_finish (image_ID,
"image/x-psd",
- attributes, metadata_flags,
+ metadata, metadata_flags,
file, NULL);
g_object_unref (file);
- g_object_unref (attributes);
+ g_object_unref (metadata);
}
values[0].data.d_status = GIMP_PDB_SUCCESS;
diff --git a/plug-ins/file-tiff/file-tiff.c b/plug-ins/file-tiff/file-tiff.c
index 473318a..719e532 100644
--- a/plug-ins/file-tiff/file-tiff.c
+++ b/plug-ins/file-tiff/file-tiff.c
@@ -329,7 +329,7 @@ run (const gchar *name,
{
/* Plug-in is either file_tiff_save or file_tiff_save2 */
- GimpAttributes *attributes;
+ GimpMetadata *metadata;
GimpMetadataSaveFlags metadata_flags;
GimpParasite *parasite;
gint32 image = param[1].data.d_int32;
@@ -359,9 +359,9 @@ run (const gchar *name,
break;
}
- attributes = gimp_image_metadata_save_prepare (orig_image,
- "image/tiff",
- &metadata_flags);
+ metadata = gimp_image_metadata_save_prepare (orig_image,
+ "image/tiff",
+ &metadata_flags);
tsvals.save_exif = (metadata_flags & GIMP_METADATA_SAVE_EXIF) != 0;
tsvals.save_xmp = (metadata_flags & GIMP_METADATA_SAVE_XMP) != 0;
@@ -465,18 +465,18 @@ run (const gchar *name,
image, drawable, orig_image, image_comment,
&saved_bpp, &error))
{
- if (attributes)
+ if (metadata)
{
/* See bug 758909: clear TIFFTAG_MIN/MAXSAMPLEVALUE because
* exiv2 saves them with wrong type and the original values
* could be invalid, see also bug 761823
*/
- gimp_attributes_remove_attribute (attributes, "Exif.Image.0x0118");
- gimp_attributes_remove_attribute (attributes, "Exif.Image.0x0119");
- gimp_attributes_remove_attribute (attributes, "Exif.Image.PageNumber");
+ gexiv2_metadata_clear_tag (metadata, "Exif.Image.0x0118");
+ gexiv2_metadata_clear_tag (metadata, "Exif.Image.0x0119");
+ gexiv2_metadata_clear_tag (metadata, "Exif.Image.PageNumber");
- gimp_attributes_set_bits_per_sample (attributes, saved_bpp);
+ gimp_metadata_set_bits_per_sample (metadata, saved_bpp);
if (tsvals.save_exif)
metadata_flags |= GIMP_METADATA_SAVE_EXIF;
@@ -498,7 +498,7 @@ run (const gchar *name,
gimp_image_metadata_save_finish (image,
"image/tiff",
- attributes, metadata_flags,
+ metadata, metadata_flags,
file, NULL);
}
@@ -516,8 +516,8 @@ run (const gchar *name,
if (export == GIMP_EXPORT_EXPORT)
gimp_image_delete (image);
- if (attributes)
- g_object_unref (attributes);
+ if (metadata)
+ g_object_unref (metadata);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]