Generate canvas image using local computer
P粉547362845
P粉547362845 2023-09-18 08:44:24
0
1
687

I want to load an image into <canvas> on my laptop so that I can use getImageData(). I'm using javascript in a local .html file. This is not a live, web-oriented project, just a personal project.

When I try to do this, I get the error: Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. at Image.loadedImage.

What is the easiest way to solve this problem? I think I may have installed an Apache server in the past to solve this problem! I just tried hfs but it didn't solve the problem.

Please note that this cannot be solved by img.crossOrigin = "Anonymous" or running on Firefox, as other outdated answers to related questions suggest.

P粉547362845
P粉547362845

reply all(1)
P粉682987577

Currently, I found that installing and running Rebex solves this problem (the files must be transferred to wwwroot)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template