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

Error in the grayscale matrix for feColorMatrix

From: Jonathan Watt <jonathan@jwatt.net>
Date: Wed, 03 Jul 2002 16:11:19 +0100
Message-ID: <3D231417.4060502@jwatt.net>
To: www-svg <www-svg@w3.org>

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

A' = R*a30 + G*a31 + B*a32 + A*a33 + 1*a34

As the matrix stands in Rec 1.0 and 1.1 the only way that A' could be 
100% (actually 99%) is if R, G and B are all 100%, meaning that the 
pixel would be white. I would suggest that for a grayscale filter the 
alpha values of each pixel should be left as it is (and certainly should 
not rely on the R, G and B values of the pixel). Therefore the values 
a30, a31 and a32 should be '0' and a33 should be '1'. The feColorMatrix 
would then change from:

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

to:

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

Note that the image showing the output from this example will also need 
to be updated.

Regards,

Jonathan.
Received on Wednesday, 3 July 2002 11:11:27 GMT

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