← Back to release summary

Canvas2D tone mapping

Category
Graphics
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
None

WPT details: Tests of setting and querying the property: https://wpt.fyi/results/html/canvas/element/manual/context-attributes/getContextAttributes.html?label=experimental&label=master&aligned https://wpt.fyi/results/html/canvas/offscreen/manual/context-attributes/getContextAttributes.html?label=experimental&label=master&aligned Tests drawing HDR colors to a 2D canvas, sending to an ImageBitmap and/or encoding to an image, then drawing the result to a new canvas. Verifies that the HDR metadata of the canvas is preserved in the full roundtrip. https://wpt.fyi/results/html/canvas/element/manual/wide-gamut-canvas/encode-hdr.html?label=experimental&label=master&aligned

Summary

Adds a toneMapping option to CanvasRenderingContext2DSettings, allowing a 2D canvas context to specify 'standard' or 'extended' tone mapping behavior when displaying HDR content, unifying the tone mapping API across 2D canvas and WebGPU.

Motivation

By default, HTML canvas elements limit their contents to the standard dynamic range (SDR) color volume of the target display. While WebGPU already supports configuring canvas tone mapping via GPUCanvasToneMapping, 2D canvas contexts lack a way to opt into displaying extended dynamic range (HDR) pixel values (such as those in float16 canvases) or explicitly constrain output to SDR. Unifying CanvasToneMapping across 2D canvas, WebGL, and WebGPU gives web developers a consistent mechanism to control how HDR canvas contents are tone mapped to the output device.

Standards & signals

Ecosystem

Explainers: https://github.com/w3c/ColorWeb-CG/blob/main/canvas-tone-map.md https://github.com/w3c/ColorWeb-CG/blob/main/hdr-big-picture.md

View on chromestatus.com