Error Exporting Merged Image using Fabric.js in Local HTML: 'Tainted canvases may not be exported #120867
-
Hello community, I'm encountering an issue when trying to export a merged image using Fabric.js in a local environment. I'm using just a simple HTML file and opening it directly in the browser, without the use of an Apache server, XAMPP, or any other server setup. When attempting to export the merged image using the following code:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yep, this is what I mentioned in your last discussion here. The problem lies with CORS. Some images come from an origin that is not the webserver the website is from. If both, the images and the website is offline (local), this is quite annoying. The solution is to have a local webserver serve the website and images. (No change to the code should be needed.) For example, you may execute in the directory of the html page and images python3 -m http.server then visit Ps. If a comment answers your question, please mark it as the answer. Thanks. |
Beta Was this translation helpful? Give feedback.
Yep, this is what I mentioned in your last discussion here.
The problem lies with CORS. Some images come from an origin that is not the webserver the website is from. If both, the images and the website is offline (local), this is quite annoying. The solution is to have a local webserver serve the website and images. (No change to the code should be needed.) For example, you may execute in the directory of the html page and images
then visit
localhost:8000/website.html
wherewebsite.html
is the name of your file. There is no other way, as far as I know.toBlob
, etc. will give the same result. If you are still trying to overlay images then you may want to look at mer…