javascript - HTML5 getImageData without canvas -


this question has answer here:

is there way use getimagedata of image without canvas? wanting pixel color @ mouse position of image.

no, can't.

but getting imagedata can done in-memory canvas, that's fast , easy :

var canvas = document.createelement('canvas'); var context = canvas.getcontext('2d'); var img = document.getelementbyid('someimageid'); context.drawimage(img, 0, 0 ); var thedata = context.getimagedata(0, 0, img.width, img.height); 

you may keep thedata variable don't have build @ each click.

note won't work if image comes domain (and won't work if open html file using file:// instead of http://).


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -