Re: [w3ctag/design-reviews] Adding support for High Dynamic Range (HDR) imagery to HTML Canvas (Issue #917)

@plinss 

> I was also wondering why not include the other color spaces supported by CSS. I understand that the rec2100-* colorspaces are supersets, by if one was working in one of the smaller colorspaces the conversions to/from rec2011-* could be lossy, right?

Canvas 2D already supports any of those CSS Color 4 SDR color spaces on input. Currently, the only Canvas 2D context color spaces available are `sRGB` and `Display P3` and the specified color is converted to the context colorspace. Furthermore, current implementations are restriccted in practice to an 8-bit per component range:

> Both CanvasRenderingContext2D and OffscreenCanvasRenderingContext2D contain an output bitmap that they render to. The pixel format of this output bitmap is currently unspecified. Many implementations use a 8 bits per channel RGB or RGBA pixel format for this bitmap.

Thus, if the specified color is outside the gamut of the 2D context, it cannot be represented (current implementations use a naive clamping operation to force the color to fit) and if it is in gamut, it will still be quantized to 8 bit resolution.

The HDR canvas proposal assumes as prerequisite the [Canvas Floating Point Color Values](https://github.com/w3c/ColorWeb-CG/blob/main/canvas_float.md) proposal which introduces the ability to use floating-point pixel formats in `CanvasRenderingContext2D`, `OffscreenCanvasRenderingContext2D`, and `ImageData`.

Together with extended range colorspaces (the colorspace is defined over the entire coordinate range, i.e. not just [0.0, 1.0] but also negative numbers and numbers greater than 1) this would allow out of gamut input colors to be stored without loss. I don't know offhand if this is required and if only HDR colorspaces benefit from Canvas FP values, but I would assume that SDR colorspaces can utilize this.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/917#issuecomment-1967712782
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/917/1967712782@github.com>

Received on Tuesday, 27 February 2024 22:09:21 UTC