diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 3f6d623536b394aa6752701e227f582554762aca..d7387a21f628c68ce89b5c8a204724b727d0e59a 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -1073,11 +1073,13 @@ function template_preprocess_links(&$variables) {
  *   - title: The title text is displayed when the image is hovered in some
  *     popular browsers.
  *   - attributes: Associative array of attributes to be placed in the img tag.
+ *   - sizes: The sizes attribute for viewport-based selection of images.
+ *     - http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content.html#introduction-3:viewport-based-selection-2
  */
 function template_preprocess_image(&$variables) {
   $variables['attributes']['src'] = file_create_url($variables['uri']);
 
-  foreach (array('width', 'height', 'alt', 'title') as $key) {
+  foreach (array('width', 'height', 'alt', 'title', 'sizes') as $key) {
     if (isset($variables[$key])) {
       // If the property has already been defined in the attributes,
       // do not override, including NULL.
@@ -2266,7 +2268,7 @@ function drupal_common_theme() {
       // - http://dev.w3.org/html5/spec/Overview.html#alt
       // The title attribute is optional in all cases, so it is omitted by
       // default.
-      'variables' => array('uri' => NULL, 'width' => NULL, 'height' => NULL, 'alt' => '', 'title' => NULL, 'attributes' => array()),
+      'variables' => array('uri' => NULL, 'width' => NULL, 'height' => NULL, 'alt' => '', 'title' => NULL, 'attributes' => array(), 'sizes' => NULL),
       'template' => 'image',
     ),
     'breadcrumb' => array(
diff --git a/core/modules/system/src/Tests/Theme/ImageTest.php b/core/modules/system/src/Tests/Theme/ImageTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..f28e1f7cfa9885253ea9e7b8100128cdd27b666d
--- /dev/null
+++ b/core/modules/system/src/Tests/Theme/ImageTest.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\system\Tests\Theme\ImageTest.
+ */
+
+namespace Drupal\system\Tests\Theme;
+
+use Drupal\simpletest\KernelTestBase;
+
+/**
+ * Tests built-in image theme functions.
+ *
+ * @group Theme
+ */
+class ImageTest extends KernelTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('system');
+
+  /**
+   * Tests that an image with the sizes attribute is output correctly.
+   */
+  function testThemeImageWithSizes() {
+    // Test with multipliers.
+    $sizes = '(max-width: ' . rand(10, 30) . 'em) 100vw, (max-width: ' . rand(30, 50) . 'em) 50vw, 30vw';
+    $image = array(
+      '#theme' => 'image',
+      '#sizes' => $sizes,
+      '#uri' => '/core/misc/druplicon.png',
+      '#width' => rand(0, 1000) . 'px',
+      '#height' => rand(0, 500) . 'px',
+      '#alt' => $this->randomMachineName(),
+      '#title' => $this->randomMachineName(),
+    );
+    $this->render($image);
+
+    // Make sure sizes is set.
+    $this->assertRaw($sizes, 'Sizes is set correctly.');
+  }
+
+}