From edc2b1736b7ebde97da90ba0b9a2388259e03f6b Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sun, 8 Mar 2026 03:45:33 +0000 Subject: [PATCH] plug-ins: Correct GUI and CMYK logic for JPEG export Resolves #9545 When exporting a JPEG as CMYK, it is possible for the "Save Profile" metadata option to be unchecked. This causes the image to be saved without its CMYK profile, resulting in an incorrect image rendering. As this is almost never the desired case, this patch changes the export logic to always save the profile IF the user has requested CMYK export and a CMYK profile is attached. Additionally, this patch fixes an issue in the export dialog where the DCT options are shown as a radio frame instead of a combobox as in GIMP 2.10. --- plug-ins/file-jpeg/jpeg-export.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/plug-ins/file-jpeg/jpeg-export.c b/plug-ins/file-jpeg/jpeg-export.c index 985446cb73..2ecfa04667 100644 --- a/plug-ins/file-jpeg/jpeg-export.c +++ b/plug-ins/file-jpeg/jpeg-export.c @@ -431,19 +431,16 @@ export_image (GFile *file, if (cmyk) { - if (save_profile) - { - GError *err = NULL; + GError *err = NULL; - cmyk_profile = gimp_image_get_simulation_profile (image); - if (! cmyk_profile && err) - g_printerr ("%s: no soft-proof profile: %s\n", G_STRFUNC, err->message); + cmyk_profile = gimp_image_get_simulation_profile (image); + if (! cmyk_profile && err) + g_printerr ("%s: no soft-proof profile: %s\n", G_STRFUNC, err->message); - if (cmyk_profile && ! gimp_color_profile_is_cmyk (cmyk_profile)) - g_clear_object (&cmyk_profile); + if (cmyk_profile && ! gimp_color_profile_is_cmyk (cmyk_profile)) + g_clear_object (&cmyk_profile); - g_clear_error (&err); - } + g_clear_error (&err); /* As far as I know, without access to JPEG specifications, we * should encode as proper "CMYK" encoding scheme. But every other @@ -650,14 +647,8 @@ export_image (GFile *file, } /* Step 4.2: store the color profile */ - if (save_profile && - /* XXX Only case when we don't save a profile even though the - * option was requested is if we store as CMYK without setting a - * profile. It would actually be better to generate a profile - * corresponding to the "naive" CMYK space we use in such case. - * But it doesn't look like babl can do this yet. - */ - (! cmyk || cmyk_profile != NULL)) + if (save_profile || + (cmyk && cmyk_profile != NULL)) { const guint8 *icc_data; gsize icc_length; @@ -986,6 +977,10 @@ save_dialog (GimpProcedure *procedure, "option-frame", "option-title", FALSE, "options"); + /* Enforce setting DCT as a combobox */ + gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog), + "dct", GTK_TYPE_COMBO_BOX); + gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog), "advanced-options", "smoothing",