W3C home > Mailing lists > Public > www-style@w3.org > February 2013

Re: [CSS4 color][CSS4 transition] color pre-multiplied vs non pre-multiplied was (Re: [CSSWG] Minutes TPAC Tue 2012-10-30 AM I: Abstract Directions, Transforms, Transitions)

From: Nicolas Robidoux <nicolas.robidoux@gmail.com>
Date: Wed, 27 Feb 2013 19:52:12 -0500
Message-ID: <CAGZHQLwEMRh_VQQsg3mu_sdm=WXw6ann7maEuMG79AzHFZvv8g@mail.gmail.com>
To: "www-style@w3.org" <www-style@w3.org>
ImageMagick, which used to create gradients in non pre-multiplied light,
has been creating gradients with pre-multiplied light for a long time now,
for the usual reason:http://www.imagemagick.org/Usage/canvas/#gradient_transparent

The exact same issue occurs when resampling. By default, resampling is now
performed in pre-multiplied light in ImageMagick. I myself was initially
surprised by this decision of Anthony Thyssen. But I now agree:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=22287. As
a result, I set up the GEGL library (the new high bit depth engine of GIMP)
so that it does all resampling in pre-multiplied light as well.

Gradients, however, are a rather mild application of resampling. When used
with a constant background, the difference between non-pre and pre is
proportional to the product of the "slope" defined by the colour change
times the "slope" defined by the transparency change. As a result, with a
constant background, there is no difference between the two when at least
one of the transparency or the colour is constant, and when the background,
the colours, and the transparency varies slowly, offensive artifacts are
generally not that offensive. (This is different than the issue of
reproducibility.)

For this reason, although pre-multiplied gives better results, I am not
sure that imposing it on developers is necessarily a "win".

I have not considered this issue carefully in the context of CSS. Take the
above more as a "data point" than an intended prescription.

-- 
Nicolas Robidoux
Image processing and applied mathematics consultant
https://www.ohloh.net/accounts/NicolasRobidoux
http://river-valley.tv/better-and-faster-image-resizing-and-resampling
http://www.imagemagick.org/Usage/filter/nicolas
Received on Thursday, 28 February 2013 07:37:52 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:06 GMT