This property can have the following values:
"srgb"
representing the sRGB color space."display-p3"
representing the display-p3 color space.The getImageData()
method allows you to explicitly request a color space. If it doesn't match the color space the canvas was initialized with, a conversion will be performed. Use the colorSpace
property to know which color space your ImageData
object is in.
const context = canvas.getContext("2d", { colorSpace: "display-p3" });
context.fillStyle = "color(display-p3 0.5 0 0)";
context.fillRect(0, 0, 10, 10);
const p3ImageData = context.getImageData(0, 0, 1, 1);
console.log(p3ImageData.colorSpace); // "display-p3"
const srgbImageData = context.getImageData(0, 0, 1, 1, { colorSpace: "srgb" });
console.log(srgbImageData.colorSpace); // "srgb"
Specifications Browser compatibility
Loadingâ¦
See alsoCanvasRenderingContext2D.createImageData()
CanvasRenderingContext2D.getImageData()
colorSpace
setting in canvas.getContext()
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.5