Automatically pixelate an image on a canvas element