diff --git a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
index aee3ffc..098ad8d 100644
--- a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
+++ b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
@@ -303,9 +303,9 @@ public function createDerivative($original_uri, $derivative_uri) {
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri = NULL) {
     foreach ($this->getEffects() as $effect) {
-      $effect->transformDimensions($dimensions);
+      $effect->transformDimensions($dimensions, $uri);
     }
   }
 
diff --git a/core/modules/image/lib/Drupal/image/ImageEffectBase.php b/core/modules/image/lib/Drupal/image/ImageEffectBase.php
index e915206..d7d16e6 100644
--- a/core/modules/image/lib/Drupal/image/ImageEffectBase.php
+++ b/core/modules/image/lib/Drupal/image/ImageEffectBase.php
@@ -40,7 +40,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri = NULL) {
     $dimensions['width'] = $dimensions['height'] = NULL;
   }
 
diff --git a/core/modules/image/lib/Drupal/image/ImageEffectInterface.php b/core/modules/image/lib/Drupal/image/ImageEffectInterface.php
index 66b7f4e..fa14704 100644
--- a/core/modules/image/lib/Drupal/image/ImageEffectInterface.php
+++ b/core/modules/image/lib/Drupal/image/ImageEffectInterface.php
@@ -33,8 +33,10 @@ public function applyEffect(ImageInterface $image);
    * @param array $dimensions
    *   Dimensions to be modified - an array with components width and height, in
    *   pixels.
+   * @param string $uri
+   *   The path of the image file relative to the Drupal files directory.
    */
-  public function transformDimensions(array &$dimensions);
+  public function transformDimensions(array &$dimensions, $uri = NULL);
 
   /**
    * Returns a render array summarizing the configuration of the image effect.
diff --git a/core/modules/image/lib/Drupal/image/ImageStyleInterface.php b/core/modules/image/lib/Drupal/image/ImageStyleInterface.php
index 3783fc4..e3b573c 100644
--- a/core/modules/image/lib/Drupal/image/ImageStyleInterface.php
+++ b/core/modules/image/lib/Drupal/image/ImageStyleInterface.php
@@ -86,8 +86,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
+   *   The path of the image file relative to the Drupal files directory.
    */
-  public function transformDimensions(array &$dimensions);
+  public function transformDimensions(array &$dimensions, $uri = NULL);
 
   /**
    * Returns a specific image effect.
diff --git a/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/DesaturateImageEffect.php b/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/DesaturateImageEffect.php
index 4d899c6..f58c8c9 100644
--- a/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/DesaturateImageEffect.php
+++ b/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/DesaturateImageEffect.php
@@ -24,7 +24,7 @@ class DesaturateImageEffect extends ImageEffectBase {
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri = NULL) {
   }
 
   /**
diff --git a/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/ResizeImageEffect.php b/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/ResizeImageEffect.php
index da9b176..b7d9945 100644
--- a/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/ResizeImageEffect.php
+++ b/core/modules/image/lib/Drupal/image/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 = NULL) {
     // 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/lib/Drupal/image/Plugin/ImageEffect/RotateImageEffect.php b/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/RotateImageEffect.php
index b0e6bf3..0601805 100644
--- a/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/RotateImageEffect.php
+++ b/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/RotateImageEffect.php
@@ -55,7 +55,7 @@ public function applyEffect(ImageInterface $image) {
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri = NULL) {
     // 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/lib/Drupal/image/Plugin/ImageEffect/ScaleImageEffect.php b/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/ScaleImageEffect.php
index 4316bd0..900d004 100644
--- a/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/ScaleImageEffect.php
+++ b/core/modules/image/lib/Drupal/image/Plugin/ImageEffect/ScaleImageEffect.php
@@ -35,7 +35,7 @@ public function applyEffect(ImageInterface $image) {
   /**
    * {@inheritdoc}
    */
-  public function transformDimensions(array &$dimensions) {
+  public function transformDimensions(array &$dimensions, $uri = NULL) {
     if ($dimensions['width'] && $dimensions['height']) {
       Image::scaleDimensions($dimensions, $this->configuration['width'], $this->configuration['height'], $this->configuration['upscale']);
     }
diff --git a/core/modules/picture/picture.module b/core/modules/picture/picture.module
index 72f52a5..9508b1b 100644
--- a/core/modules/picture/picture.module
+++ b/core/modules/picture/picture.module
@@ -229,7 +229,7 @@ function theme_picture($variables) {
   // Fallback image, output as source with media query.
   $sources[] = array(
     'src' => entity_load('image_style', $variables['style_name'])->buildUrl($variables['uri']),
-    'dimensions' => picture_get_image_dimensions($variables),
+    'dimensions' => picture_get_image_dimensions($variables, $variables['uri']),
   );
 
   // All breakpoints and multipliers.
@@ -248,7 +248,7 @@ function theme_picture($variables) {
       if (count($new_sources) == 1) {
         $sources[] = array(
           'src' => entity_load('image_style', $new_sources[0]['style_name'])->buildUrl($new_sources[0]['uri']),
-          'dimensions' => picture_get_image_dimensions($new_sources[0]),
+          'dimensions' => picture_get_image_dimensions($new_sources[0], $new_sources[0]['uri']),
           'media' => $breakpoint->mediaQuery,
         );
       }
@@ -260,7 +260,7 @@ function theme_picture($variables) {
         }
         $sources[] = array(
           'srcset' => implode(', ', $srcset),
-          'dimensions' => picture_get_image_dimensions($new_sources[0]),
+          'dimensions' => picture_get_image_dimensions($new_sources[0], $new_source['uri']),
           'media' => $breakpoint->mediaQuery,
         );
       }
@@ -346,24 +346,26 @@ function theme_picture_source($variables) {
 /**
  * Determines the dimensions of an image.
  *
- * @param $variables
+ * @param array $variables
  *   An associative array containing:
  *   - style_name: The name of the style to be used to alter the original image.
  *   - width: The width of the source image (if known).
  *   - height: The height of the source image (if known).
+ * @param string $uri
+ *   The path of the image file relative to the Drupal files directory.
  *
  * @return array
  *   Dimensions to be modified - an array with components width and height, in
  *   pixels.
  */
-function picture_get_image_dimensions($variables) {
+function picture_get_image_dimensions($variables, $uri = NULL) {
   // Determine the dimensions of the styled image.
   $dimensions = array(
     'width' => $variables['width'],
     'height' => $variables['height'],
   );
 
-  entity_load('image_style', $variables['style_name'])->transformDimensions($dimensions);
+  entity_load('image_style', $variables['style_name'])->transformDimensions($dimensions, $uri);
 
   return $dimensions;
 }
