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