basic image processing technique using html5 canvas and javascript