Documentation: Desaturate


This action converts the image to grayscale. It has the option of either taking the average value of the RGB triplet, ie. (R+G+B)/3, or use the more common conversion method of mixing 30% red, 59% green and 11% blue to get a brightness value closer to what the human eye perceives. It defaults to using the latter method. The average method is only supported by Canvas enabled browsers, IE always uses the aforementioned conversion.


Use average:

Example usage

var img = new Image();
img.onload = function() {
	Pixastic.process(img, "desaturate", {average : false});
img.src = "myimage.jpg";


  • average (bool)
    If true, (R+G+B)/3 will be used as the brigtness value

View source: desaturate.js

Browser support