Script to flip an image using a canvas and javascript pixel by pixel