W3C home > Mailing lists > Public > www-svg@w3.org > July 2002

Error in the grayscale matrix for feColorMatrix

From: Thomas E Deweese <thomas.deweese@kodak.com>
Date: Wed, 3 Jul 2002 12:55:33 -0400
Message-ID: <15651.11397.277680.327818@frog.rl.kodak.com>
To: Jonathan Watt <jonathan@jwatt.net>
Cc: www-svg <www-svg@w3.org>

>>>>> "JW" == Jonathan Watt <jonathan@jwatt.net> writes:

JW> The example in section 15.10 demonstrates a filter that is
JW> supposed to do a conversion to grayscale, however the matrix given
JW> is incorrect. For feColorMatrix the value A' is obtained from:

    Where do you read that it is supposed to do a conversion to
grayscale?  It is an _EXAMPLE_ of using the matrix form of feMatrix.

JW> I would suggest that for a grayscale filter the alpha values of
JW> each pixel should be left as it is (and certainly should not rely
JW> on the R, G and B values of the pixel). Therefore the values a30,
JW> a31 and a32 should be '0' and a33 should be '1'. The feColorMatrix
JW> would then change [...] to:

JW> <feColorMatrix type="matrix" in="SourceGraphic"
JW>       values=".33 .33 .33 0 0
JW>               .33 .33 .33 0 0
JW>               .33 .33 .33 0 0
JW>                0   0   0  1 0"/>

    Well if you really want to convert an RGB image to gray scale you
should use a matrix that looks like:


<feColorMatrix type="matrix" in="SourceGraphic"
      values=".213 .715 .072 0 0
              .213 .715 .072 0 0
              .213 .715 .072 0 0
               0   0    0    1 0"/>

    To account for the visual weighting of the RGB components that
occurs in the eye (very sensitive to green very insensitive to blue).
The above matrix happens to be exactly what you get with:

    <feColorMatrix type="saturate" values="0" in="SourceGraphic"/>

    Given that the issue is with an example, and the example does not
purport to do a grayscale conversion I think we are OK here.

    What do you think?
Received on Wednesday, 3 July 2002 12:55:36 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:23 GMT