Canvas is tainted due to CORS | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

Canvas is tainted due to CORS

I am using an image I have downloaded which is in the same folder with the rest of my files, I view the page offline, I'm not using a server, and for some reason I get security error when I try to use getImageData(), how do I fix it?

23rd Feb 2021, 9:16 AM
Karak10 - avatar
1 Antwort
+ 3
Set image crossOrigin property to "Anonymous" to bypass cors. Eg. var img = new Image(); img.crossOrigin = "Anonymous"; // to bypass cors for imgur image link img.src = "";
24th Feb 2021, 12:52 PM
CalviŇ▓ - avatar