From 4ff4ce2870747a988ecc408efc864c0d250bebc3 Mon Sep 17 00:00:00 2001 From: Jacob Boerema Date: Mon, 13 Jan 2025 16:15:02 -0500 Subject: [PATCH] app: fix #7287 failure to save metadata when creating a new image When starting from an image we created in GIMP, saving/exporting with metadata and/or thumbnail (thumbnails are part of the exif metadata) failed, because our metadata was not initialized for newly created images. To fix this, create a metadata object in `gimp_create_image`, that way when creating a new image in the gui, but also when creating an image programmatically, gets metadata attached at the start. We need to do that here, because we need to have metadata available even for images that we import that do not have metadata attached. --- app/core/gimp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/core/gimp.c b/app/core/gimp.c index ca5d950a48..d3b941a898 100644 --- a/app/core/gimp.c +++ b/app/core/gimp.c @@ -63,6 +63,7 @@ #include "gimpgradient.h" #include "gimpidtable.h" #include "gimpimage.h" +#include "gimpimage-metadata.h" #include "gimpimagefile.h" #include "gimplist.h" #include "gimpmarshal.h" @@ -1036,12 +1037,17 @@ gimp_create_image (Gimp *gimp, GimpPrecision precision, gboolean attach_comment) { - GimpImage *image; + GimpImage *image; + GimpMetadata *metadata; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); image = gimp_image_new (gimp, width, height, type, precision); + metadata = gimp_metadata_new (); + gimp_image_set_metadata (image, metadata, FALSE); + g_object_unref (metadata); + if (attach_comment) { const gchar *comment;