plug-ins: clean and fix webp export.
- Default parameters must be set before gimp_get_data(). Otherwise when you export the first time, you end up with broken defaults (basically everything to 0, in particular a problem with quality values of 0 which makes an export failure). - Some minor formatting here and there and an unused variable.
This commit is contained in:
parent
d516f9bef8
commit
8fdee80ff8
3 changed files with 25 additions and 11 deletions
|
|
@ -127,7 +127,7 @@ save_dialog (WebPSaveParams *params,
|
|||
/* Create the descriptive label at the top */
|
||||
text = g_strdup_printf ("<b>%s</b>", _("WebP Options"));
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup(GTK_LABEL(label), text);
|
||||
gtk_label_set_markup (GTK_LABEL(label), text);
|
||||
g_free (text);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
|
@ -227,7 +227,6 @@ save_dialog (WebPSaveParams *params,
|
|||
{
|
||||
GtkWidget *animation_box;
|
||||
GtkWidget *animation_box2;
|
||||
GtkWidget *animation_label;
|
||||
GtkWidget *loop_anim_checkbox;
|
||||
GtkWidget *animation_expander;
|
||||
GtkWidget *animation_frame;
|
||||
|
|
|
|||
|
|
@ -407,11 +407,15 @@ parse_ms_tag (const gchar *str)
|
|||
}
|
||||
|
||||
static gint
|
||||
get_layer_delay(gint32 layer)
|
||||
get_layer_delay (gint32 layer)
|
||||
{
|
||||
gchar *layer_name = gimp_item_get_name (layer);
|
||||
gint delay_ms = parse_ms_tag (layer_name);
|
||||
gchar *layer_name;
|
||||
gint delay_ms;
|
||||
|
||||
layer_name = gimp_item_get_name (layer);
|
||||
delay_ms = parse_ms_tag (layer_name);
|
||||
g_free (layer_name);
|
||||
|
||||
return delay_ms;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ query (void)
|
|||
{ GIMP_PDB_INT32, "exif", "Toggle saving exif data (0/1)" },
|
||||
{ GIMP_PDB_INT32, "iptc", "Toggle saving iptc data (0/1)" },
|
||||
{ GIMP_PDB_INT32, "xmp", "Toggle saving xmp data (0/1)" },
|
||||
{ GIMP_PDB_INT32, "delay", "Delay to use when timestamp are not available or forced" },
|
||||
{ GIMP_PDB_INT32, "force-delay", "Toggle to for delay" }
|
||||
{ GIMP_PDB_INT32, "delay", "Delay to use when timestamps are not available or forced" },
|
||||
{ GIMP_PDB_INT32, "force-delay", "Force delay on all frames" }
|
||||
};
|
||||
|
||||
gimp_install_procedure (LOAD_PROC,
|
||||
|
|
@ -188,9 +188,21 @@ run (const gchar *name,
|
|||
{
|
||||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
case GIMP_RUN_INTERACTIVE:
|
||||
/* Possibly retrieve data */
|
||||
/* Default settings. */
|
||||
params.lossless = FALSE;
|
||||
params.animation = FALSE;
|
||||
params.loop = TRUE;
|
||||
params.quality = 90.0f;
|
||||
params.alpha_quality = 100.0f;
|
||||
params.exif = TRUE;
|
||||
params.iptc = TRUE;
|
||||
params.xmp = TRUE;
|
||||
params.delay = 200;
|
||||
params.force_delay = FALSE;
|
||||
/* Possibly override with session data */
|
||||
gimp_get_data (SAVE_PROC, ¶ms);
|
||||
params.preset = g_strdup ("default"); /* can't serialize strings, so restore default */
|
||||
/* can't serialize strings, so restore default */
|
||||
params.preset = g_strdup ("default");
|
||||
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "WebP",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
|
|
@ -203,7 +215,6 @@ run (const gchar *name,
|
|||
{
|
||||
values[0].data.d_status = GIMP_PDB_CANCEL;
|
||||
status = GIMP_PDB_CANCEL;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -248,7 +259,7 @@ run (const gchar *name,
|
|||
|
||||
if (status != GIMP_PDB_SUCCESS)
|
||||
{
|
||||
g_free(params.preset);
|
||||
g_free (params.preset);
|
||||
g_free (layers);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue