search

Home  >  Q&A  >  body text

Generate canvas image using local computer

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粉547362845P粉547362845473 days ago657

reply all(1)I'll reply

  • P粉682987577

    P粉6829875772023-09-19 00:14:46

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

    reply
    0
  • Cancelreply