I would like to load an image into a <canvas>
on my laptop so I can use getImageData()
. I am using javascript in a local .html file. It is not a live, web facing project. Just a personal project.
I get the error: Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. at Image.loadedImage when I try and do this.
What is the easiest solution to this problem? I think in the past I may have installed an Apache server just to address this issue! I just tried hfs but it did not work (to fix this issue).
Note that this cannot be fixed using img.crossOrigin = "Anonymous"
or by running on Firefox as other, out of date, answers to related problems have suggested.