Commit 07eb13c7 authored by MihailZenkov's avatar MihailZenkov Committed by Jehan
Browse files

Bug 769976 - JPEG export ignores quality setting and subsampling fix.

Set use_orig_quality when both the quality and the subsampling are the
same as in the originally-imported jpeg.

Also improve subsampling initial selection: use the original subsampling
unless the default one is the best or the original one is the worst.
The current code was wrong and would often use the default subsampling
even when worse than the original one.
parent 7c29077a
......@@ -1356,16 +1356,20 @@ load_gui_defaults (JpegSaveGui *pg)
gtk_adjustment_set_value (restart_markers, jsvals.restart);
g_signal_handler_unblock (pg->use_restart_markers, pg->handler_id_restart);
gtk_adjustment_set_value (GTK_ADJUSTMENT (pg->quality),
jsvals.quality);
gtk_adjustment_set_value (GTK_ADJUSTMENT (pg->smoothing),
jsvals.smoothing);
if (gimp_drawable_is_rgb (drawable_ID_global))
/* Don't override quality and subsampling setting if we alredy set it from original */
if (!jsvals.use_orig_quality)
{
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (pg->subsmp),
jsvals.subsmp);
gtk_adjustment_set_value (GTK_ADJUSTMENT (pg->quality),
jsvals.quality);
if (gimp_drawable_is_rgb (drawable_ID_global))
{
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (pg->subsmp),
jsvals.subsmp);
}
}
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (pg->dct),
......
......@@ -446,15 +446,21 @@ run (const gchar *name,
if (orig_quality > jsvals.quality)
{
jsvals.quality = orig_quality;
jsvals.use_orig_quality = TRUE;
}
if (orig_subsmp == JPEG_SUBSAMPLING_1x1_1x1_1x1 ||
((gint) orig_subsmp > 0 &&
jsvals.subsmp == JPEG_SUBSAMPLING_1x1_1x1_1x1))
/* Skip changing subsampling to original if we alredy have best
* setting or if original have worst setting */
if (!(jsvals.subsmp == JPEG_SUBSAMPLING_1x1_1x1_1x1 ||
orig_subsmp == JPEG_SUBSAMPLING_2x2_1x1_1x1))
{
jsvals.subsmp = orig_subsmp;
}
if (orig_quality == jsvals.quality &&
orig_subsmp == jsvals.subsmp)
{
jsvals.use_orig_quality = TRUE;
}
}
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment