diff --git a/core/modules/image/src/Entity/ImageStyle.php b/core/modules/image/src/Entity/ImageStyle.php
index a05d3a8..3c68e01 100644
--- a/core/modules/image/src/Entity/ImageStyle.php
+++ b/core/modules/image/src/Entity/ImageStyle.php
@@ -307,9 +307,9 @@ public function createDerivative($original_uri, $derivative_uri) {
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri) {
     foreach ($this->getEffects() as $effect) {
-      $effect->transformDimensions($dimensions);
+      $effect->transformDimensions($dimensions, $uri);
     }
   }
 
diff --git a/core/modules/image/src/ImageEffectBase.php b/core/modules/image/src/ImageEffectBase.php
index d0ef256..3d09570 100644
--- a/core/modules/image/src/ImageEffectBase.php
+++ b/core/modules/image/src/ImageEffectBase.php
@@ -70,7 +70,7 @@ public static function create(ContainerInterface $container, array $configuratio
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri) {
     // Most image effects will not change the dimensions. This base
     // implementation represents this behavior. Override this method if your
     // image effect does change the dimensions.
diff --git a/core/modules/image/src/ImageEffectInterface.php b/core/modules/image/src/ImageEffectInterface.php
index 7d2c4ca..2d8a58b 100644
--- a/core/modules/image/src/ImageEffectInterface.php
+++ b/core/modules/image/src/ImageEffectInterface.php
@@ -43,8 +43,10 @@ public function applyEffect(ImageInterface $image);
    *   - height: the height in pixels, or NULL if unknown
    *   When either of the dimensions are NULL, the corresponding HTML attribute
    *   will be omitted when an image style using this image effect is used.
+   * @param string $uri
+   *   Original image file URI.
    */
-  public function transformDimensions(array &$dimensions);
+  public function transformDimensions(array &$dimensions, $uri);
 
   /**
    * Returns the extension the derivative would have have after applying this
diff --git a/core/modules/image/src/ImageStyleInterface.php b/core/modules/image/src/ImageStyleInterface.php
index b28d199..97d5584 100644
--- a/core/modules/image/src/ImageStyleInterface.php
+++ b/core/modules/image/src/ImageStyleInterface.php
@@ -127,8 +127,10 @@ public function createDerivative($original_uri, $derivative_uri);
    * @param array $dimensions
    *   Associative array passed by reference. Implementations have to store the
    *   resulting width and height, in pixels.
+   * @param string $uri
+   *   Original image file URI.
    */
-  public function transformDimensions(array &$dimensions);
+  public function transformDimensions(array &$dimensions, $uri);
 
   /**
    * Determines the extension of the derivative without generating it.
diff --git a/core/modules/image/src/Plugin/ImageEffect/ResizeImageEffect.php b/core/modules/image/src/Plugin/ImageEffect/ResizeImageEffect.php
index 37c2c93..14d8983 100644
--- a/core/modules/image/src/Plugin/ImageEffect/ResizeImageEffect.php
+++ b/core/modules/image/src/Plugin/ImageEffect/ResizeImageEffect.php
@@ -36,7 +36,7 @@ public function applyEffect(ImageInterface $image) {
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri) {
     // The new image will have the exact dimensions defined for the effect.
     $dimensions['width'] = $this->configuration['width'];
     $dimensions['height'] = $this->configuration['height'];
diff --git a/core/modules/image/src/Plugin/ImageEffect/RotateImageEffect.php b/core/modules/image/src/Plugin/ImageEffect/RotateImageEffect.php
index 9964886..2507a8c 100644
--- a/core/modules/image/src/Plugin/ImageEffect/RotateImageEffect.php
+++ b/core/modules/image/src/Plugin/ImageEffect/RotateImageEffect.php
@@ -42,7 +42,7 @@ public function applyEffect(ImageInterface $image) {
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri) {
     // If the rotate is not random and the angle is a multiple of 90 degrees,
     // then the new dimensions can be determined.
     if (!$this->configuration['random'] && ((int) ($this->configuration['degrees']) == $this->configuration['degrees']) && ($this->configuration['degrees'] % 90 == 0)) {
diff --git a/core/modules/image/src/Plugin/ImageEffect/ScaleImageEffect.php b/core/modules/image/src/Plugin/ImageEffect/ScaleImageEffect.php
index 0b9bece..eaec2a9 100644
--- a/core/modules/image/src/Plugin/ImageEffect/ScaleImageEffect.php
+++ b/core/modules/image/src/Plugin/ImageEffect/ScaleImageEffect.php
@@ -36,7 +36,7 @@ public function applyEffect(ImageInterface $image) {
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri) {
     if ($dimensions['width'] && $dimensions['height']) {
       Image::scaleDimensions($dimensions, $this->configuration['width'], $this->configuration['height'], $this->configuration['upscale']);
     }
diff --git a/core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/NullTestImageEffect.php b/core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/NullTestImageEffect.php
index bcf63ef..266b8af 100644
--- a/core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/NullTestImageEffect.php
+++ b/core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/NullTestImageEffect.php
@@ -23,7 +23,7 @@ class NullTestImageEffect extends ImageEffectBase {
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri) {
     // Unset image dimensions.
     $dimensions['width'] = $dimensions['height'] = NULL;
   }
diff --git a/core/modules/responsive_image/responsive_image.module b/core/modules/responsive_image/responsive_image.module
index 925fe3c..0f48061 100644
--- a/core/modules/responsive_image/responsive_image.module
+++ b/core/modules/responsive_image/responsive_image.module
@@ -319,6 +319,7 @@ function template_preprocess_responsive_image(&$variables) {
  *       ID.
  *     - width: The width of the image (if known).
  *     - height: The height of the image (if known).
+ *     - uri: The URI of the image file.
  * @param \Drupal\breakpoint\BreakpointInterface $breakpoint
  *   The breakpoint for this source tag.
  * @param array $multipliers
@@ -341,7 +342,7 @@ function responsive_image_build_source_attributes(ImageInterface $image, array $
         // Loop through the image styles for this breakpoint and multiplier.
         foreach ($image_style_mapping['image_mapping']['sizes_image_styles'] as $image_style_name) {
           // Get the dimensions.
-          $dimensions = responsive_image_get_image_dimensions($image_style_name, array('width' => $width, 'height' => $height));
+          $dimensions = responsive_image_get_image_dimensions($image_style_name, array('width' => $width, 'height' => $height), $variables['uri']);
           // Get MIME type.
           $derivative_mime_type = responsive_image_get_mime_type($image_style_name, $extension);
           $derivative_mime_types[] = $derivative_mime_type;
@@ -402,12 +403,14 @@ function responsive_image_build_source_attributes(ImageInterface $image, array $
  *   An associative array containing:
  *   - width: The width of the source image (if known).
  *   - height: The height of the source image (if known).
+ * @param string $uri
+ *   The URI of the image file.
  *
  * @return array
  *   Dimensions to be modified - an array with components width and height, in
  *   pixels.
  */
-function responsive_image_get_image_dimensions($image_style_name, array $dimensions) {
+function responsive_image_get_image_dimensions($image_style_name, array $dimensions, $uri) {
   // Determine the dimensions of the styled image.
   if ($image_style_name == RESPONSIVE_IMAGE_EMPTY_IMAGE) {
     $dimensions = array(
@@ -418,7 +421,7 @@ function responsive_image_get_image_dimensions($image_style_name, array $dimensi
   else {
     $entity = ImageStyle::load($image_style_name);
     if ($entity instanceof Drupal\image\Entity\ImageStyle) {
-      $entity->transformDimensions($dimensions);
+      $entity->transformDimensions($dimensions, $uri);
     }
   }
 
