From d8df72869f1d43e6526dc9ebe6f457ad0976c853 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Mon, 20 Jan 2025 18:28:36 +0000 Subject: [PATCH] core: Copy simulation settings when duplicating images Among other issues, this bug impacted exporting images with CMYK simulation profiles. Because the image was duplicated for export, we lose the simulation profile information after gimp_export_options_get_image () is called. This patch ensures the profile, simulation intent, and simulation black point compensation toggles are carried over to the new image. --- app/core/gimpimage-duplicate.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c index 65af564e4a..725c048f39 100644 --- a/app/core/gimpimage-duplicate.c +++ b/app/core/gimpimage-duplicate.c @@ -85,6 +85,9 @@ static void gimp_image_duplicate_parasites (GimpImage *image, GimpImage *new_image); static void gimp_image_duplicate_color_profile (GimpImage *image, GimpImage *new_image); +static void gimp_image_duplicate_simulation_profile + (GimpImage *image, + GimpImage *new_image); GimpImage * @@ -118,6 +121,9 @@ gimp_image_duplicate (GimpImage *image) gimp_image_duplicate_parasites (image, new_image); gimp_image_duplicate_color_profile (image, new_image); + /* Copy the simulation profile settings */ + gimp_image_duplicate_simulation_profile (image, new_image); + /* Copy the colormap if necessary */ gimp_image_duplicate_colormap (image, new_image); @@ -585,3 +591,20 @@ gimp_image_duplicate_color_profile (GimpImage *image, gimp_image_set_color_profile (new_image, profile, NULL); _gimp_image_set_hidden_profile (new_image, hidden, FALSE); } + +static void +gimp_image_duplicate_simulation_profile (GimpImage *image, + GimpImage *new_image) +{ + GimpColorProfile *profile; + GimpColorRenderingIntent intent; + gboolean bpc; + + profile = gimp_image_get_simulation_profile (image); + intent = gimp_image_get_simulation_intent (image); + bpc = gimp_image_get_simulation_bpc (image); + + gimp_image_set_simulation_profile (new_image, profile); + gimp_image_set_simulation_intent (new_image, intent); + gimp_image_set_simulation_bpc (new_image, bpc); +}