HTML5 image processing using javascript