← Chrome 160 reference · All APIs

v160 · graphics · enabled by default

Canvas2D tone mapping

Adds the toneMapping option to CanvasRenderingContext2DSettings (using the shared CanvasToneMapping dictionary and CanvasToneMappingMode enum: "standard" or "extended") and reflects it from getContextAttributes(). Authors can opt 2D and offscreen canvases into displaying high dynamic range (HDR) pixel values — such as floating-point srgb-linear or display-p3-linear buffers — or keep output constrained to standard dynamic range (SDR), matching WebGPU’s tone mapping model.

Limited availability — Canvas2D toneMapping is not Baseline (shipping in Chrome 160)

  • Chrome · 160 (desktop, Android, WebView)
  • Edge · Mirrors Chromium (160)
  • Firefox · No signal yet
  • Safari · Supportive on HTML PR #11734; no shipped release

No dedicated web-features entry exists on webstatus.dev for Canvas2D tone mapping (checked 2026-11-24; parent canvas-2d is Baseline Widely available). BCD api/CanvasRenderingContext2D.json does not yet carry a subfeature for toneMapping on getContextAttributes() or CanvasRenderingContext2DSettings.

at a glance

Shipped inChrome 160 (desktop, Android, Android WebView), enabled by default — listed under “Enabled by default” in the milestone=160 listing and confirmed in the ChromeStatus API record
Runtime flagBlink runtime feature CanvasToneMapping (listed in runtime_enabled_features.json5; no origin trial, no standalone chrome://flags toggle; tested behind --enable-blink-features=CanvasToneMapping prior to Chrome 160 ship)
SpecificationHTML Living Standard — CanvasToneMapping & CanvasToneMappingMode (merged via whatwg/html#11734); CSS Color HDR Module — dynamic-range-limit
ExplainersW3C ColorWeb-CG — Tone mapping for 2D Canvas · HDR on the web: the big picture
TAG revieww3ctag/design-reviews#1194 (Issues addressed)
Tracking bugissues.chromium.org/448552449
Web platform testselement getContextAttributes.html, offscreen getContextAttributes.html, wide-gamut-canvas/encode-hdr.html
ChromeStatus5077164932333568 — Canvas2D tone mapping

why it exists

By default, HTML <canvas> elements clamp their rendered output to the standard dynamic range (SDR) color volume of the target display, even when backed by a colorType: "float16" buffer with linear color spaces (srgb-linear or display-p3-linear) holding luminance values above 1.0. WebGPU previously defined GPUCanvasToneMapping to opt canvases into extended dynamic range, but 2D canvases lacked an equivalent mechanism. Moving CanvasToneMapping and CanvasToneMappingMode into the HTML Living Standard unifies HDR tone mapping across 2D Canvas, WebGL, and WebGPU while keeping "standard" as the backwards-compatible default.

Source: ChromeStatus motivation (5077164932333568); WHATWG HTML PR #11734; ColorWeb-CG canvas-tone-map.md.

Syntax

HTML defines one enum, one dictionary, and one new member on CanvasRenderingContext2DSettings (shared by both HTMLCanvasElement.getContext("2d", options) and OffscreenCanvas.getContext("2d", options), and returned by getContextAttributes()):

enum CanvasToneMappingMode {
  "standard",
  "extended"
};

dictionary CanvasToneMapping {
  CanvasToneMappingMode mode = "standard";
};

partial dictionary CanvasRenderingContext2DSettings {
  CanvasToneMapping toneMapping = {};
};

This reference covers the four parts of the Chrome 160 contract: CanvasToneMappingMode, CanvasToneMapping, CanvasRenderingContext2DSettings.toneMapping and getContextAttributes(), and output rendering, dynamic-range-limit, ImageBitmap, and HDR encoding.

Source: HTML Living Standard — CanvasToneMappingMode; CanvasToneMapping; Blink canvas_tone_mapping.idl; Blink canvas_rendering_context_2d_settings.idl.

CanvasToneMappingMode enum

Inputs & allowed values. CanvasToneMappingMode accepts exactly two case-sensitive strings: "standard" (default) and "extended".

Outputs & color-volume behavior. The enum selects how the canvas output bitmap’s HDR headroom is bounded before color space conversion to the display:

Normative behavior of CanvasToneMappingMode values in HTML Living Standard
ValueBitmap HDR headroomRendering & encoding effect
"standard" (default)0 stops (SDR)Restricts content to the standard dynamic range of the target display. Values above 1.0 in linear float16 buffers are tone mapped / clamped to SDR on display and when encoded to PNG, JPEG, or WebP.
"extended"UnlimitedDoes not restrict the bitmap’s HDR headroom during tone mapping; pixel values above 1.0 remain intact up to the display’s effective HDR headroom (further limited by CSS dynamic-range-limit) and are preserved when encoded to HDR-capable image outputs.
Source: HTML Living Standard — CanvasToneMappingMode; WHATWG HTML PR #11734.

CanvasToneMapping dictionary

Inputs. CanvasToneMapping is a WebIDL dictionary with one optional member: mode of type CanvasToneMappingMode, defaulting to "standard". Passing an empty object {} or omitting mode resolves to { mode: "standard" }. Future specifications may add additional tone-mapping parameters to this dictionary without changing the call shape.

Outputs. When HTML’s get a canvas tone mapping algorithm processes a CanvasToneMapping value, it constructs an internal canvas tone mapping record storing mode. When reflected back through getContextAttributes(), the returned CanvasToneMapping object always populates mode with either "standard" or "extended".

Source: HTML Living Standard — CanvasToneMapping; WPT getContextAttributes.html.

CanvasRenderingContext2DSettings.toneMapping & getContextAttributes()

Inputs. Pass toneMapping in the second argument to HTMLCanvasElement.getContext("2d", settings) or OffscreenCanvas.getContext("2d", settings) alongside colorSpace (for example "srgb-linear" or "display-p3-linear") and colorType: "float16". When toneMapping is omitted or {}, the context defaults to { mode: "standard" }.

Outputs. ctx.getContextAttributes() returns a new CanvasRenderingContext2DSettings dictionary whose toneMapping member is { mode: "standard" } or { mode: "extended" } reflecting the context’s active tone mapping mode. In browsers that do not implement Canvas2D tone mapping, getContextAttributes().toneMapping is undefined.

Source: HTML Living Standard — The canvas settings; WPT getContextAttributes.html; Blink canvas_context_creation_attributes_module.idl.

Output rendering, dynamic-range-limit, ImageBitmap, and HDR encoding

Inputs & rendering pipeline. When a canvas backing store bitmap is presented to an output device — directly from <canvas>, through a placeholder <canvas> bound to an OffscreenCanvas, or via ImageBitmapRenderingContext — the browser first tone maps the bitmap according to its toneMapping mode to the output device’s HDR headroom as limited by the element’s CSS dynamic-range-limit property, and then converts to the output device’s color space. The resulting HDR headroom is min(bitmap HDR headroom, target headroom), and out-of-gamut colors at that headroom are projected into gamut in an implementation-defined manner.

Outputs & metadata preservation.

Source: HTML Living Standard — Colour spaces and colour correction; WPT encode-hdr.html; ColorWeb-CG canvas-tone-map.md.

Errors, validation, and feature detection

Source: HTML Living Standard — CanvasToneMapping; Blink canvas_context_creation_attributes_module.idl; WPT encode-hdr.html.

Context, exposure, and lifecycle

Exposure & prerequisites. CanvasToneMapping, CanvasToneMappingMode, and CanvasRenderingContext2DSettings.toneMapping are exposed on both Window (via HTMLCanvasElement.getContext("2d", options)) and Worker contexts (via OffscreenCanvas.getContext("2d", options)). No secure context, permission prompt, or user activation is required. Rendering pixel values brighter than SDR white additionally requires an HDR-capable display, a compatible pixel format (colorType: "float16") and wide/linear color space (such as srgb-linear or display-p3-linear), and an ancestor/element dynamic-range-limit that permits HDR headroom.

Lifecycle & immutability. toneMapping is fixed when the 2D rendering context is first created. Calling canvas.getContext("2d", { toneMapping: { mode: "extended" } }) on a canvas that already initialized a 2D context returns the existing context unchanged and ignores the new options; to switch modes dynamically at presentation time without recreating the canvas, keep toneMapping: { mode: "extended" } and modulate CSS dynamic-range-limit on the <canvas> element, or create a fresh canvas element.

Source: HTML Living Standard — The canvas settings; WPT offscreen getContextAttributes.html; CSS Color HDR dynamic-range-limit.

Examples

Live interactive example from the Chrome Platform Showcase — Canvas2D tone mapping (sibling demos: mode reflection, dynamic-range-limit interplay, encode & ImageBitmap round-trip, feature detection kit, one dictionary, three contexts). Source: chrome-platform-showcase.

Creating an extended HDR 2D canvas and feature-detecting toneMapping

function supportsCanvas2DToneMapping() {
  const probe = new OffscreenCanvas(1, 1);
  const ctx = probe.getContext("2d", {
    toneMapping: { mode: "extended" },
  });
  return ctx?.getContextAttributes()?.toneMapping?.mode === "extended";
}

const canvas = document.querySelector("canvas");
const ctx = canvas.getContext("2d", {
  colorSpace: "srgb-linear",
  colorType: "float16",
  toneMapping: { mode: "extended" }, // CanvasToneMappingMode: "standard" | "extended"
});

// Reflects { mode: "extended" } in Chrome 160+; undefined in older browsers.
const attrs = ctx.getContextAttributes();
console.log("Active CanvasToneMapping:", attrs.toneMapping);

// Draw SDR white on the left and 4x HDR highlight on the right.
ctx.fillStyle = "color(srgb-linear 1 1 1)";
ctx.fillRect(0, 0, canvas.width / 2, canvas.height);

ctx.fillStyle = "color(srgb-linear 4 4 4)";
ctx.fillRect(canvas.width / 2, 0, canvas.width / 2, canvas.height);
Source: HTML Living Standard — CanvasToneMapping; WPT getContextAttributes.html.

Preserving toneMapping across ImageBitmap, OffscreenCanvas, and dynamic-range-limit

// Encode HDR pixels from an OffscreenCanvas with extended toneMapping
const offscreen = new OffscreenCanvas(64, 64);
const offCtx = offscreen.getContext("2d", {
  colorSpace: "srgb-linear",
  colorType: "float16",
  toneMapping: { mode: "extended" },
});
offCtx.fillStyle = "color(srgb-linear 8 8 8)";
offCtx.fillRect(0, 0, 64, 64);

// ImageBitmap preserves the source canvas's toneMapping behavior.
const bitmap = offscreen.transferToImageBitmap();

// Alternatively, encode to PNG/WebP/JPEG while retaining HDR metadata:
const hdrBlob = await offscreen.convertToBlob({ type: "image/png" });

// Constrain presentation headroom declaratively via CSS dynamic-range-limit:
// canvas.style.dynamicRangeLimit = "standard"; // caps output to SDR
Source: WPT encode-hdr.html; ColorWeb-CG canvas-tone-map.md.

Browser compatibility

Support for CanvasToneMapping, CanvasToneMappingMode, and CanvasRenderingContext2DSettings.toneMapping. BCD does not yet track a toneMapping subfeature; versions below come from ChromeStatus 5077164932333568, WHATWG HTML PR #11734, and vendor standards positions (checked 2026-11-24).
BrowsertoneMapping supportEvidence / notesBase getContextAttributes() (BCD)
Chrome (desktop, Android, WebView)160Enabled by default in Chrome 160 across desktop, Android, and WebView per ChromeStatus API record (CanvasToneMapping Blink runtime feature)73
Edge160 (mirror)Chromium-based; mirrors Chromium’s CanvasToneMapping implementation79 (mirror)
FirefoxNo releaseMozilla standards-positions#1359 (No signal yet)117
SafariNo releasePositive / supportive signal on WHATWG HTML PR #11734; no shipped Safari version yet15
Source: ChromeStatus API record (5077164932333568); BCD api/CanvasRenderingContext2D.json; mozilla/standards-positions#1359; WebKit comment on PR #11734.

Security and privacy

Configuring CanvasToneMapping ("standard" or "extended") only governs how the canvas’s own pixel values are mapped to the display’s dynamic range and how encoded image metadata is tagged. According to ChromeStatus and the HTML specification, toneMapping does not expose the output device’s HDR headroom, display peak luminance, or gamut projection algorithm to JavaScript, introducing no new cross-origin data channel or fingerprinting surface beyond existing canvas capabilities. Security and privacy reviews are listed as Pending in the ChromeStatus API record (checked 2026-11-24).

Source: ChromeStatus security_risks (5077164932333568); HTML Living Standard — Colour spaces and colour correction.

Specifications

see also