W3C home > Mailing lists > Public > public-fx@w3.org > January to March 2012

Re: Brightness filter in CSS Filters spec is wrong?

From: Rik Cabanier <cabanier@gmail.com>
Date: Sat, 28 Jan 2012 11:12:15 -0800
Message-ID: <CAGN7qDB+=cDRdSkrB_YYJsTtyAYwcWMYnP7e=B8nuxDHHQjTHA@mail.gmail.com>
To: Chris Marrin <cmarrin@apple.com>
Cc: public-fx@w3.org
On Fri, Jan 27, 2012 at 10:55 AM, Chris Marrin <cmarrin@apple.com> wrote:

>
> On Jan 26, 2012, at 9:25 AM, Rik Cabanier wrote:
>
> Hi Chris,
>
> I got a reply from the Photoshop team:
>
> Photoshop has two algorithms for brightness / contrast, depending on
> whether you turn on the "legacy" checkbox. The legacy approach is the old
> nave version of just sliding the histogram right and left or spreading it
> out linearly, per channel.
>
>
> In legacy mode,
>
> Brightness n adds or subtracts n to / from each channel, clamping at 0 or
> 255
>
> Contrast spreads or compresses the histogram linearly for each channel.
> Contrast +100 makes all channel values 0 or 255. Contrast 100 makes all
> channel values 127. Contrast 100 and Brightness +100 makes all channels
> 227.
>
>
> These operations can be useful for steps in analysis of images, or for
> manipulating masks or in some cases for manipulating graphics, but they
> tend to be horrible for photographic images, and so the first advice in
> every Photoshop book for adjusting brightness and contrast on photographs
> used to be "never use brightness and contrast".
>
> The non-legacy B&C adjustments copied Lightroom (camera raw)'s original
> process version. They're curve-based and produce much better results on
> photographic images.
>
>
>
>
>
>
>
> It sounds like 'legacy' mode in Photoshop matches the filters spec but it
> doesn't produce good results.
> I think we know have 3 options:
> - use the current spec. Output is not very good + Brighten doesn't go to
> white
> - use the flash approach. Output is not very good but brighten goes to
> white.
> - get an improved algorithm, possibly based on what existing editing
> software does.
>
>
> Well, legacy mode sounds like my proposed change to the brightness filter.
> The current brightness filter multiplies the amount by rgb. My proposal
> adds it, which sounds like what the legacy mode of photoshop does. That is
> what I've implemented in WebKit now and it gives you the results you
> expect. I'm not sure which of these you're talking about (1 or 2)?
>
> I'd be concerned about developing a new algorithm. I understand that
> editing software has more advanced, curve based approaches. But I'd be
> concerned going down that path because we could easily get ratholed. What
> curves do we use? How do we accelerate it? We removed gamma from the spec
> for similar reasons. Hardware accelerating non-linear transforms is
> difficult. It seems reasonable to let more advanced editing be done offline
> and keep the CSS filters simple.
>
> I agree. Your current approach is reasonable. (= option 1)
We can always add a better one later.

Rik
Received on Saturday, 28 January 2012 19:12:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 28 January 2012 19:12:49 GMT