HTML5/Titanium code to convert color images to grayscale