1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

Compare commits

...

1 Commits

Author SHA1 Message Date
Alx Sa
12a0e6fb22 plug-ins: Warn about no transparency in JPEGs
This adds a warning label to the JPEG export dialogue if the layer contains
transparency, to indicate another format should be used.
2023-07-14 09:54:28 -04:00
3 changed files with 35 additions and 14 deletions

View File

@@ -838,11 +838,13 @@ gboolean
save_dialog (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpDrawable *drawable,
GimpImage *image)
GimpImage *image,
gboolean has_alpha)
{
GtkWidget *dialog;
GtkWidget *widget;
GtkWidget *profile_label;
GtkWidget *vbox;
GtkListStore *store;
GimpColorProfile *cmyk_profile = NULL;
gint orig_quality;
@@ -982,20 +984,36 @@ save_dialog (GimpProcedure *procedure,
NULL);
}
gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
"advanced-options",
"smoothing",
"progressive",
"cmyk-frame",
vbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
"advanced-options",
"smoothing",
"progressive",
"cmyk-frame",
#ifdef C_ARITH_CODING_SUPPORTED
"arithmetic-frame",
"arithmetic-frame",
#else
"optimize",
"optimize",
#endif
"restart-frame",
"sub-sampling",
"dct",
NULL);
"restart-frame",
"sub-sampling",
"dct",
NULL);
if (has_alpha)
{
GtkWidget *warning;
warning = g_object_new (GIMP_TYPE_HINT_BOX,
"icon-name", GIMP_ICON_DIALOG_WARNING,
"hint",
_("The JPEG format does not support transparency.\n"
"Use another format like PNG or TIFF if you need "
"to retain transparency."),
NULL);
gtk_box_pack_end (GTK_BOX (vbox), warning, FALSE, FALSE, 12);
gtk_widget_set_visible (warning, TRUE);
}
gimp_procedure_dialog_fill_frame (GIMP_PROCEDURE_DIALOG (dialog),
"advanced-frame", "advanced-title", FALSE,
"advanced-options");

View File

@@ -33,6 +33,7 @@ gboolean save_image (GFile *file,
gboolean save_dialog (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpDrawable *drawable,
GimpImage *image);
GimpImage *image,
gboolean has_alpha);
#endif /* __JPEG_SAVE_H__ */

View File

@@ -438,6 +438,7 @@ jpeg_save (GimpProcedure *procedure,
GimpExportReturn export = GIMP_EXPORT_CANCEL;
GError *error = NULL;
gboolean has_alpha = FALSE;
gint orig_num_quant_tables = -1;
gint orig_quality = -1;
JpegSubsampling orig_subsmp = JPEG_SUBSAMPLING_2x2_1x1_1x1;
@@ -451,6 +452,7 @@ jpeg_save (GimpProcedure *procedure,
preview_layer = NULL;
orig_image = image;
has_alpha = gimp_drawable_has_alpha (drawables[0]);
switch (run_mode)
{
@@ -579,7 +581,7 @@ jpeg_save (GimpProcedure *procedure,
drawable_global = drawables[0];
/* First acquire information with a dialog */
if (! save_dialog (procedure, config, drawables[0], orig_image))
if (! save_dialog (procedure, config, drawables[0], orig_image, has_alpha))
{
status = GIMP_PDB_CANCEL;
}