W3C home > Mailing lists > Public > public-css-archive@w3.org > November 2020

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

From: Jacob Rus via GitHub <sysbot+gh@w3.org>
Date: Thu, 26 Nov 2020 04:53:38 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-734073018-1606366417-sysbot+gh@w3.org>
All of the standard “rendering intents” as handled by e.g. Photoshop have pretty bad results. To be honest every automatic gamut mapping tool I have ever used was pretty much garbage. I think gamut mapping *can* be done properly in an automatic way, but in my own practical imaging I always put in manual effort to get the effect I want.

The ideal for photographs is to do something fancy where you try to balance preserving local (color and lightness) contrast so you don’t end up with areas that are blown out or overly compressed vs. keeping colors that are out of gamut as colorful as possible, all while trying to preserving hue.

For something like CSS colors, each color should be treated independently; making the result depend on surrounding colors is going to be counterintuitive and confusing. If there is a well known source gamut (e.g. mapping some specific print gamut to a specific screen or vice versa) it’s possible to make an effort to avoid hard clipping, by applying some kind of nonlinear function with parameters set based on gamut size (usually this means that even colors which are nominally inside the target gamut will have colorfulness reduced somewhat if the source gamut is wider in that region). Even when gamuts are known I would avoid making colors *more* colorful than the source gamut supports; this can make images look punchier but also can trample author’s intentions.

Plausible methods for reducing colorfulness to bring out-of-gamut colors inside include mapping inward along a constant hue/lightness line, mapping toward middle gray, or mapping toward a gray whose lightness depends on the hue. Both of these work better than what most software does by default.

Gamut mapping should be done in some color space that more or less separates hue/value/chroma cleanly in a way that matches human perception. CIELAB works okay but the blue–purple shift can be annoying sometimes.

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

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 26 November 2020 04:53:41 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:22 UTC