Monday, 20 June 2016

javascript - Google Chrome tainted canvas from local images

I am trying to make a vanilla JavaScript game with the html 5 canvas element, and in order to make color-based hit boxes, I need to grab image data from certain spots on the canvas. Whenever I use getImageData(), I get this error:




Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.





All of the images that are being displayed on the canvas are being pulled from a local file. Is there any way that I could get this working on Chrome?



I draw the images by placing html image tags on the page and using context.drawImage(*img id, x, y*);

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...