Re: [csswg-drafts] [css-color-4] Define gamut mapping (#5191)

@LeaVerou wrote:

> LCH chroma reduction is a common one, but fails terribly for yellows, producing results far worse than even simple component clipping. E.g. when color(display-p3 1 1 0) is converted to sRGB using chroma reduction via binary search, it produces rgb(100% 97.5% 77.4%), a light yellow, whereas something closer to rgb(95% 100% 0%) would have been a far better fit.

The simple method is to reduce Chroma (either progressively, or by binary search) until the color is in gamut. It fails terribly for light yellows and cyans, due to concavity of the gamut boundary. However, a slight modification produces much better results:

- start with startColor
- binary search reduction of Chroma, giving currentColor
- per-component clip, giving currentClippedColor
- done if deltaE2000 between currentClippedColor and currentColor < threshold

This is better described (with examples and diagrams) [on Color.js gamut mapping page](https://colorjs.io/docs/gamut-mapping.html). The concavity issue is shown on the first diagram, where chroma reduction actually pushes the modified color **outside P3** until it finally drops back when massively desaturated.

When color(display-p3 1 1 0) is converted to sRGB using chroma reduction via this modified method (with a threshold of 2, which is barely visible), it produces rgb(100% 99.1% 9.1%), which is a much better fit.

Having examined this for P3 -> sRGB and for REC2020 -> P3 gamut mapping, which are the two that I expect to be most common, I feel fairly comfortable proposing this for the specification, _for RGB to RGB mapping_.

RGB to CMYK, CMYK to RGB, and CMYK to CMYK are likely to use ICC profiles, and v4 ICC will map this in two stages, relative to the Perceptual Reference Material Gamut. Since that part is defined by ICC I don't think the spec needs to cover it.

-- 
GitHub Notification of comment by svgeesus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5191#issuecomment-687643172 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 5 September 2020 18:06:13 UTC