javascript/jquery getImageData color pick of image -


i have fiddle here: http://jsfiddle.net/r6rgp/

i try pick color of image/canvas rgb 000.

but obviously, image has no real black pixels. what's wrong that?

document.getelementbyid("canvas").onload=function(){ var c=document.getelementbyid("mycanvas"); var ctx=c.getcontext("2d"); var img=document.getelementbyid("canvas"); ctx.drawimage(img,0,0); var imgdata=ctx.getimagedata(0,0,c.width,c.height);  red=imgdata.data[0]; green=imgdata.data[1]; blue=imgdata.data[2]; alpha=imgdata.data[3];  console.log(red + " " + green + " " + blue + " " + alpha); //always 0 0 0   ctx.putimagedata(imgdata,0,0);   }; 

jsfiddle.net doesn't allow cross-origin data:

unable image data canvas because canvas has been tainted cross-origin data.

and seems there's problem in script too:

uncaught error: securityerror: dom exception 18.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -