最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What is "colorspace" in imagedata? - Stack Overflow

programmeradmin5浏览0评论

Needed to do some pixel manipulation, but ImageData has changed. Now it has a colorSpace property.

What is this, and how do I use it as normal?

Just get an ImageData object in Chrome to reproduce.

Needed to do some pixel manipulation, but ImageData has changed. Now it has a colorSpace property.

What is this, and how do I use it as normal?

Just get an ImageData object in Chrome to reproduce.

Share Improve this question edited May 25, 2022 at 13:38 Yves M. 31k24 gold badges109 silver badges149 bronze badges asked Apr 24, 2017 at 7:49 KrisoKriso 1651 gold badge2 silver badges10 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 10

This es from this proposal to implement color-space management in canvas.

Currently, canvas is stuck with legacy-srgb 8 bit depth. Some monitor can't handle this low level of information.

This is still a proposal, but the currently proposed syntax to set the colorSpace of a 2DContext would be ctx.getContext('2d', {colorSpace: 'color-space', pixelFormat: 'pixelFormat', linearPixelMath: boolean});

Currently, no one has implemented it yet, but chromium and chrome are in the process of doing so.
Their current implementation only exposes a getter colorSpace property on ImageData objects, and a getContextAttributes method on the Context2D object, but there is not yet a way to set it for us (maybe there is with some startup flag, but I didn't find it).

Note: You need to set the Experimental canvas features flag to true in chrome://flags to get access to these properties.

But anyway, this property should in no way alter your code. All the default parameters of the ImageData are still the same.

发布评论

评论列表(0)

  1. 暂无评论