I'm trying to save the canvas to the file from the web page.
The canvas is pretty complicated and has been built from several images (few semi-transparent .png files, 2 svg elements, and 4 other canvases) and no matter how I'm trying to save it, using canvas.toDataURL()
method or using domtoimage [library] (https://github.com/tsayen/dom-to-image) or canvas2image or fileSaver or canvasToBLob libraries - the result is the same: an image without svg(and <image>
element inside) parts. So i'm getting only the parts, that were built from canvas. I read about the 'tainted' canvases, but the images host server is the same as webpage is.
Moreover I'm confused, because if I saving the canvas by clicking RCM and selecting "Save image as" function - it saves exactly what I need - the full picture.
The whole code is huge and the saving options are different, so I will put here only one saving option:
domtoimage.toBlob(canvasElement)
.then(function (blob) {
console.log(blob);
window.saveAs(blob, 'my-node.png');
});
The picture on the left is what im getting when using 'save image as' feature in browser, and on the right is the image saved by js through the toBlob
will be happy to get any suggestions of how to save the full image automatically :)