Skip to content

imageDataToGreyScale

Matt Ellen edited this page Oct 23, 2015 · 2 revisions

Takes an ImageData object and a boolean.
Returns a clone of the ImageData object with all the pixels R, G, B values set to either the minimum or maximum of the R, G, B values, depending on how the boolean is set. true uses the maximum, false uses the minimum.

var greyData = jsai.imageDataToGreyScale(someData, true);
//uses the brightest of the R, G, B values to create the grey scale

var darkGreyData = jsai.imageDataToGreyScale(someData, false);
//uses the darkest of the R, G, B values to create the grey scale

Clone this wiki locally