diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc
index d0ef114..daf4882 100644
--- a/core/modules/image/image.admin.inc
+++ b/core/modules/image/image.admin.inc
@@ -376,6 +376,12 @@ function image_effect_form_submit($form, &$form_state) {
     'data' => $form_state['values']['data'],
     'weight' => $form_state['values']['weight'],
   );
+
+  // Use the image effect ID (ieid) in case of an edit.
+  if (!empty($form_state['image_effect']['ieid'])) {
+    $effect['ieid'] = $form_state['image_effect']['ieid'];
+  }
+
   image_effect_save($form_state['image_style']['name'], $effect);
   drupal_set_message(t('The image effect was successfully applied.'));
   $form_state['redirect'] = 'admin/config/media/image-styles/edit/' . $form_state['image_style']['name'];
diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index aa05d04..b5609a8 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -1124,8 +1124,15 @@ function image_effect_save($style_name, $effect) {
     // @todo The machine name must not use any special non-alphanumeric
     //   characters, and may also not contain dots/periods, as that is the
     //   config system's nested key syntax.
-    $effect['ieid'] = preg_replace('@[^a-zA-Z0-9_-]@', '', $effect['ieid']);
+    $new_ieid = preg_replace('@[^a-zA-Z0-9_-]@', '', $effect['ieid']);
+    // Make sure the image effect ID (ieid) is unique.
+    $effects = $config->get('effects');
+    if (array_key_exists($new_ieid, $effects)) {
+      $new_ieid .= user_password();
+    }
+    $effect['ieid'] = $new_ieid;
   }
+
   $config->set('effects.' . $effect['ieid'], $effect);
   $config->save();
   $style = image_style_load($style_name);
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
index 12d845c..f9a746c 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
@@ -258,4 +258,41 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
     $this->drupalGet('node/' . $nid);
     $this->assertRaw(image_style_url('thumbnail', file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri), t('Image displayed using style replacement style.'));
   }
+
+  /**
+   * Verify that editing an image effect does not cause it to duplicate.
+   */
+  function testEditEffect() {
+    // Add a scale effect.
+    $this->drupalGet('admin/config/media/image-styles/add');
+    $this->drupalPost(NULL, array('name' => 'test_style_effect_edit'), t('Create new style'));
+    $this->drupalPost(NULL, array('new' => 'image_scale_and_crop'), t('Add'));
+    $this->drupalPost(NULL, array('data[width]' => '300', 'data[height]' => '200'), t('Add effect'));
+    $this->assertText(t('Scale and crop 300x200'));
+
+    // There should normally be only one edit link on this page initially.
+    $this->clickLink(t('edit'));
+    $this->drupalPost(NULL, array('data[width]' => '360', 'data[height]' => '240'), t('Update effect'));
+    $this->assertText(t('Scale and crop 360x240'));
+
+    // Check the previous effect is replaced.
+    $this->assertNoText(t('Scale and crop 300x200'));
+
+    // Add another scale effect.
+    $this->drupalGet('admin/config/media/image-styles/add');
+    $this->drupalPost(NULL, array('name' => 'test_style_scale_edit_scale'), t('Create new style'));
+    $this->drupalPost(NULL, array('new' => 'image_scale'), t('Add'));
+    $this->drupalPost(NULL, array('data[width]' => '12', 'data[height]' => '19'), t('Add effect'));
+
+    // Edit the last added scale effect.
+    $this->clickLink(t('edit'));
+    $this->drupalPost(NULL, array('data[width]' => '24', 'data[height]' => '19'), t('Update effect'));
+    $this->drupalPost(NULL, array('new' => 'image_scale'), t('Add'));
+
+    // Add another scale effect and make sure both exists.
+    $this->drupalPost(NULL, array('data[width]' => '12', 'data[height]' => '19'), t('Add effect'));
+    $this->assertText(t('Scale 24x19'));
+    $this->assertText(t('Scale 12x19'));
+  }
+
 }
