W3C home > Mailing lists > Public > public-fx@w3.org > October to December 2013

Re: [filter-effects] hue-rotate() and saturate() filters

From: Chris Lilley <chris@w3.org>
Date: Mon, 14 Oct 2013 22:23:51 +0200
Message-ID: <1802590808.20131014222351@w3.org>
To: Rik Cabanier <cabanier@gmail.com>
CC: Michael Mullany <michael@sencha.com>, "public-fx@w3.org" <public-fx@w3.org>
Hello Rik,

Monday, October 14, 2013, 8:42:46 PM, you wrote:

> On Sat, Oct 12, 2013 at 8:53 PM, Michael Mullany <michael@sencha.com> wrote:
> Has there been any thought of converting content to HSL before
> applying these filter shorthands? Or adding true HSL primitives to
> the filter toolbox? (Something like an feFuncH or feFuncS).  

> As Chris mentions, being able to switch the working colorspace to
> Lab

CIE Lab is a non-linear light, approximately perceptually linear,
rectilinear colour space. Linear matrix operations in that space would
not naturally be hue preserving or saturation/chroma preserving.

As Michael pointed out, a polar coordinate space is a more natural fit

> (not sure what CIELCHab is though)

Rik, for someone who has implemented a color management engine in a
commercial product you continually surprise me with what you do and
don't know.

In 1976 the CIE produced two colourspaces - CIE L*a*b* and CIE L*u*v*.
In normal conversation the asterisks are dropped and they are called
Lab and Luv respectively.

Polar forms of each were also produced, retaining the L axis and
transforming a,b (or u,v) into a Hue angle H and a Chroma (similar to
saturation) C. Because the two forms both have the same names for the
three axes (L, C, H) they are disambiguated by a subscript ab or uv as
appropriate - LCHab or LCHuv.

Incidentally these polar forms were what inspired Tektronix et al to
come up with HSL, HSV and similar polar forms of RGB. Unlike the
measurement-based CIE forms, however, HSL and HSV are not perceptually
uniform and have some odd behaviour - primary blue (#00F) and secondary
yellow (#FF0) have the same lightness in HSL and the same value in

> However, doing so would require a whole new set of formulas in the
> filters specification and a lot of work in the browsers... 

Not really. In each case, you transform to the working colourspace,
perform channelwise operations, then transform back.

Best regards,
 Chris                            mailto:chris@w3.org
Received on Monday, 14 October 2013 20:23:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:49:47 UTC