I do not think there is a built-in setting for this. But you should be able to reduce the value of each pixel channel to a more limited set of values. Sort of:
var ctx, width, height; var factor = 8; var pixels = ctx.getImageData(0, 0, width, height).data; function reduce(val) { return Math.round(val/factor)*factor; } for(var i = 0, l = pixels.length; i < l; i+=4) { pixels[i] = reduce(pixels[i]); pixels[i+1] = reduce(pixels[i+1]); pixels[i+2] = reduce(pixels[i+2]); } ctx.putImageData(pixels, 0, 0)
gthmb source share