diff --git a/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php b/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
index d16330f..95d2997 100644
--- a/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
+++ b/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
@@ -147,7 +147,7 @@ protected function load() {
           'extension' => image_type_to_extension($this->getType(), FALSE),
           'transparent_color' => $this->getTransparentColor(),
         );
-        if ($this->apply('create_new', $data)) {
+        if ($this->apply('create_temp', $data)) {
           imagecopy($this->getResource(), $resource, 0, 0, 0, 0, imagesx($resource), imagesy($resource));
           imagedestroy($resource);
         }
diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Convert.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Convert.php
index 93b9360..a20137a 100644
--- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Convert.php
+++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Convert.php
@@ -60,7 +60,7 @@ protected function execute(array $arguments) {
       'extension' => $arguments['extension'],
       'transparent_color' => $this->getToolkit()->getTransparentColor()
     );
-    if ($this->getToolkit()->apply('create_new', $data)) {
+    if ($this->getToolkit()->apply('create_temp', $data)) {
       if (imagecopyresampled($this->getToolkit()->getResource(), $original_resource, 0, 0, 0, 0, $width, $height, $width, $height)) {
         imagedestroy($original_resource);
         return TRUE;
diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/CreateNew.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/CreateNew.php
index 00fecad..0c69841 100644
--- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/CreateNew.php
+++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/CreateNew.php
@@ -7,9 +7,6 @@
 
 namespace Drupal\system\Plugin\ImageToolkit\Operation\gd;
 
-use Drupal\Component\Utility\Color;
-use Drupal\Component\Utility\SafeMarkup;
-
 /**
  * Defines GD2 create_new image operation.
  *
@@ -50,77 +47,21 @@ protected function arguments() {
   /**
    * {@inheritdoc}
    */
-  protected function validateArguments(array $arguments) {
-    // Assure extension is supported.
-    if (!in_array($arguments['extension'], $this->getToolkit()->getSupportedExtensions())) {
-      throw new \InvalidArgumentException(SafeMarkup::format("Invalid extension (@value) specified for the image 'convert' operation", array('@value' => $arguments['extension'])));
-    }
-
-    // Assure integers for width and height.
-    $arguments['width'] = (int) round($arguments['width']);
-    $arguments['height'] = (int) round($arguments['height']);
-
-    // Fail when width or height are 0 or negative.
-    if ($arguments['width'] <= 0) {
-      throw new \InvalidArgumentException(SafeMarkup::format("Invalid width (@value) specified for the image 'create_new' operation", array('@value' => $arguments['width'])));
-    }
-    if ($arguments['height'] <= 0) {
-      throw new \InvalidArgumentException(SafeMarkup::format("Invalid height (@value) specified for the image 'create_new' operation", array('@value' => $arguments['height'])));
-    }
-
-    // Assure transparent color is a valid hex string.
-    if ($arguments['transparent_color'] && !Color::validateHex($arguments['transparent_color'])) {
-      throw new \InvalidArgumentException(SafeMarkup::format("Invalid transparent color (@value) specified for the image 'create_new' operation", array('@value' => $arguments['transparent_color'])));
-    }
-
-    return $arguments;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   protected function execute(array $arguments) {
-    // Get the image type.
-    $type = $this->getToolkit()->extensionToImageType($arguments['extension']);
-
-    // Create the resource.
-    if (!$res = imagecreatetruecolor($arguments['width'], $arguments['height'])) {
-      return FALSE;
-    }
-
-    // Fill the resource with transparency as possible.
-    switch ($type) {
-      case IMAGETYPE_PNG:
-        imagealphablending($res, FALSE);
-        $transparency = imagecolorallocatealpha($res, 0, 0, 0, 127);
-        imagefill($res, 0, 0, $transparency);
-        imagealphablending($res, TRUE);
-        imagesavealpha($res, TRUE);
-        break;
-
-      case IMAGETYPE_GIF:
-        if (empty($arguments['transparent_color'])) {
-          // No transparency color specified, fill white.
-          $fill_color = imagecolorallocate($res, 255, 255, 255);
-        }
-        else {
-          $fill_rgb = Color::hexToRgb($arguments['transparent_color']);
-          $fill_color = imagecolorallocate($res, $fill_rgb['red'], $fill_rgb['green'], $fill_rgb['blue']);
-          imagecolortransparent($res, $fill_color);
-        }
-        imagefill($res, 0, 0, $fill_color);
-        break;
+    // Stores the original GD resource.
+    $original_res = $this->getToolkit()->getResource();
 
-      case IMAGETYPE_JPEG:
-        imagefill($res, 0, 0, imagecolorallocate($res, 255, 255, 255));
-        break;
+    // Applies the 'create_temp' operation and retrieves the current GD
+    // resource.
+    $result = $this->getToolkit()->apply('create_temp', $arguments);
+    $current_res = $this->getToolkit()->getResource();
 
+    // Destroys the original resource if the new image is correct.
+    if (is_resource($original_res) && is_resource($current_res) && $original_res !== $current_res) {
+      imagedestroy($original_res);
     }
 
-    // Update the toolkit properties.
-    $this->getToolkit()->setType($type);
-    $this->getToolkit()->setResource($res);
-    return TRUE;
+    return $result;
   }
 
 }
diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/CreateTemp.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/CreateTemp.php
new file mode 100644
index 0000000..5d36e32
--- /dev/null
+++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/CreateTemp.php
@@ -0,0 +1,126 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\system\Plugin\ImageToolkit\Operation\gd\CreateTemp.
+ */
+
+namespace Drupal\system\Plugin\ImageToolkit\Operation\gd;
+
+use Drupal\Component\Utility\Color;
+use Drupal\Component\Utility\SafeMarkup;
+
+/**
+ * Defines GD2 create_temp image operation.
+ *
+ * @ImageToolkitOperation(
+ *   id = "gd_create_temp",
+ *   toolkit = "gd",
+ *   operation = "create_temp",
+ *   label = @Translation("Set a new temporary image"),
+ *   description = @Translation("Creates a new temporary transparent resource.")
+ * )
+ */
+class CreateTemp extends GDImageToolkitOperationBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function arguments() {
+    return array(
+      'width' => array(
+        'description' => 'The width of the image, in pixels',
+      ),
+      'height' => array(
+        'description' => 'The height of the image, in pixels',
+      ),
+      'extension' => array(
+        'description' => 'The extension of the image file (e.g. png, gif, etc.)',
+        'required' => FALSE,
+        'default' => 'png',
+      ),
+      'transparent_color' => array(
+        'description' => 'The RGB hex color for GIF transparency',
+        'required' => FALSE,
+        'default' => '#ffffff',
+      ),
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function validateArguments(array $arguments) {
+    // Assure extension is supported.
+    if (!in_array($arguments['extension'], $this->getToolkit()->getSupportedExtensions())) {
+      throw new \InvalidArgumentException(SafeMarkup::format("Invalid extension (@value) specified for the image 'create_temp' operation", array('@value' => $arguments['extension'])));
+    }
+
+    // Assure integers for width and height.
+    $arguments['width'] = (int) round($arguments['width']);
+    $arguments['height'] = (int) round($arguments['height']);
+
+    // Fail when width or height are 0 or negative.
+    if ($arguments['width'] <= 0) {
+      throw new \InvalidArgumentException(SafeMarkup::format("Invalid width (@value) specified for the image 'create_temp' operation", array('@value' => $arguments['width'])));
+    }
+    if ($arguments['height'] <= 0) {
+      throw new \InvalidArgumentException(SafeMarkup::format("Invalid height (@value) specified for the image 'create_temp' operation", array('@value' => $arguments['height'])));
+    }
+
+    // Assure transparent color is a valid hex string.
+    if ($arguments['transparent_color'] && !Color::validateHex($arguments['transparent_color'])) {
+      throw new \InvalidArgumentException(SafeMarkup::format("Invalid transparent color (@value) specified for the image 'create_temp' operation", array('@value' => $arguments['transparent_color'])));
+    }
+
+    return $arguments;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function execute(array $arguments) {
+    // Get the image type.
+    $type = $this->getToolkit()->extensionToImageType($arguments['extension']);
+
+    // Create the resource.
+    if (!$res = imagecreatetruecolor($arguments['width'], $arguments['height'])) {
+      return FALSE;
+    }
+
+    // Fill the resource with transparency as possible.
+    switch ($type) {
+      case IMAGETYPE_PNG:
+        imagealphablending($res, FALSE);
+        $transparency = imagecolorallocatealpha($res, 0, 0, 0, 127);
+        imagefill($res, 0, 0, $transparency);
+        imagealphablending($res, TRUE);
+        imagesavealpha($res, TRUE);
+        break;
+
+      case IMAGETYPE_GIF:
+        if (empty($arguments['transparent_color'])) {
+          // No transparency color specified, fill white.
+          $fill_color = imagecolorallocate($res, 255, 255, 255);
+        }
+        else {
+          $fill_rgb = Color::hexToRgb($arguments['transparent_color']);
+          $fill_color = imagecolorallocate($res, $fill_rgb['red'], $fill_rgb['green'], $fill_rgb['blue']);
+          imagecolortransparent($res, $fill_color);
+        }
+        imagefill($res, 0, 0, $fill_color);
+        break;
+
+      case IMAGETYPE_JPEG:
+        imagefill($res, 0, 0, imagecolorallocate($res, 255, 255, 255));
+        break;
+
+    }
+
+    // Update the toolkit properties.
+    $this->getToolkit()->setType($type);
+    $this->getToolkit()->setResource($res);
+    return TRUE;
+  }
+
+}
diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Crop.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Crop.php
index 21d59f4..45e611b 100644
--- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Crop.php
+++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Crop.php
@@ -90,7 +90,7 @@ protected function execute(array $arguments) {
       'extension' => image_type_to_extension($this->getToolkit()->getType(), FALSE),
       'transparent_color' => $this->getToolkit()->getTransparentColor()
     );
-    if ($this->getToolkit()->apply('create_new', $data)) {
+    if ($this->getToolkit()->apply('create_temp', $data)) {
       if (imagecopyresampled($this->getToolkit()->getResource(), $original_resource, 0, 0, $arguments['x'], $arguments['y'], $arguments['width'], $arguments['height'], $arguments['width'], $arguments['height'])) {
         imagedestroy($original_resource);
         return TRUE;
diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php
index be72427..77b608f 100644
--- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php
+++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php
@@ -69,7 +69,7 @@ protected function execute(array $arguments = array()) {
       'extension' => image_type_to_extension($this->getToolkit()->getType(), FALSE),
       'transparent_color' => $this->getToolkit()->getTransparentColor()
     );
-    if ($this->getToolkit()->apply('create_new', $data)) {
+    if ($this->getToolkit()->apply('create_temp', $data)) {
       if (imagecopyresampled($this->getToolkit()->getResource(), $original_resource, 0, 0, 0, 0, $arguments['width'], $arguments['height'], imagesx($original_resource), imagesy($original_resource))) {
         imagedestroy($original_resource);
         return TRUE;
diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Rotate.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Rotate.php
index 0284b42..37632bc 100644
--- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Rotate.php
+++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Rotate.php
@@ -98,17 +98,25 @@ protected function execute(array $arguments) {
       return FALSE;
     }
 
-    $this->getToolkit()->setResource(imagerotate($this->getToolkit()->getResource(), 360 - $arguments['degrees'], $arguments['background_idx']));
-
-    // GIFs need to reassign the transparent color after performing the rotate,
-    // but only do so, if the image already had transparency of its own, or the
-    // rotate added a transparent background.
-    if (!empty($arguments['gif_transparent_color'])) {
-      $transparent_idx = imagecolorexactalpha($this->getToolkit()->getResource(), $arguments['gif_transparent_color']['red'], $arguments['gif_transparent_color']['green'], $arguments['gif_transparent_color']['blue'], $arguments['gif_transparent_color']['alpha']);
-      imagecolortransparent($this->getToolkit()->getResource(), $transparent_idx);
+    // Stores the original GD resource.
+    $original_res = $this->getToolkit()->getResource();
+
+    if ($new_res = imagerotate($this->getToolkit()->getResource(), 360 - $arguments['degrees'], $arguments['background_idx'])) {
+      $this->getToolkit()->setResource($new_res);
+      imagedestroy($original_res);
+
+      // GIFs need to reassign the transparent color after performing the rotate,
+      // but only do so, if the image already had transparency of its own, or the
+      // rotate added a transparent background.
+      if (!empty($arguments['gif_transparent_color'])) {
+        $transparent_idx = imagecolorexactalpha($this->getToolkit()->getResource(), $arguments['gif_transparent_color']['red'], $arguments['gif_transparent_color']['green'], $arguments['gif_transparent_color']['blue'], $arguments['gif_transparent_color']['alpha']);
+        imagecolortransparent($this->getToolkit()->getResource(), $transparent_idx);
+      }
+
+      return TRUE;
     }
 
-    return TRUE;
+    return FALSE;
   }
 
 }
diff --git a/core/modules/system/src/Tests/Image/ToolkitGdTest.php b/core/modules/system/src/Tests/Image/ToolkitGdTest.php
index d7f55dc..7d4a7c6 100644
--- a/core/modules/system/src/Tests/Image/ToolkitGdTest.php
+++ b/core/modules/system/src/Tests/Image/ToolkitGdTest.php
@@ -278,9 +278,19 @@ function testManipulations() {
           }
         }
 
+        // Store the original GD resource.
+        $old_res = $toolkit->getResource();
+
         // Perform our operation.
         $image->apply($values['function'], $values['arguments']);
 
+        // If the operation replaced the resource, check that the old one has
+        // been destroyed.
+        $new_res = $toolkit->getResource();
+        if ($new_res !== $old_res) {
+          $this->assertFalse(is_resource($old_res), SafeMarkup::format("'%operation' destroyed the original resource.", ['%operation' => $values['function']]));
+        }
+
         // To keep from flooding the test with assert values, make a general
         // value for whether each group of values fail.
         $correct_dimensions_real = TRUE;
@@ -389,6 +399,16 @@ function testManipulations() {
       }
     }
 
+    // Test that CreateNew does not leave orphaned GD resources.
+    $image = $this->imageFactory->get($file_path);
+    for ($i = 0; $i < 2; $i++) {
+      $old_res = $image->getToolkit()->getResource();
+      $image->createNew(2000, 2000);
+      $new_res = $image->getToolkit()->getResource();
+      $this->assertFalse(is_resource($old_res), 'CreateNew destroyed the original resource.');
+      $this->assertTrue(is_resource($new_res), 'CreateNew has created a new resource.');
+    }
+
     // Test failures of CreateNew.
     $image = $this->imageFactory->get();
     $image->createNew(-50, 20);
