--- gimp-8c2c22ccb4091f77b28b2d5eb8141064a5d55f76/plug-ins/file-jpeg.orig/jpeg-save.c
+++ gimp-8c2c22ccb4091f77b28b2d5eb8141064a5d55f76/plug-ins/file-jpeg/jpeg-save.c
@@ -1356,16 +1361,20 @@
   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),
--- gimp-8c2c22ccb4091f77b28b2d5eb8141064a5d55f76/plug-ins/file-jpeg.orig/jpeg.c
+++ gimp-8c2c22ccb4091f77b28b2d5eb8141064a5d55f76/plug-ins/file-jpeg/jpeg.c
@@ -446,14 +446,20 @@
               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;
