Graphite
Graphite copied to clipboard
Cannot export artwork with embedded canvas
Now that #1256 adds a <canvas />
renderer in the SVG output, we need to turn that canvas content into a base64'd image in the JS. We already have to do this for turning blob URL images into base64 images, so this just adds more functionality in that existing place. It reads the canvas image data, turns it into base64, and replaces the canvas with an image.
To reproduce the issue, drag an image into the document. Then in its layer's node graph, add the Draw Canvas
node just before the Output
node. Then go to File > Export and check the console:
rasterization.ts:47 Uncaught (in promise) DOMException: Failed to execute 'toBlob' on 'HTMLCanvasElement': Tainted canvases may not be exported.
at s (https://dev.graphite.rs/index.8fa82b7d.js:17:84260)
at new Promise (<anonymous>)
at fi (https://dev.graphite.rs/index.8fa82b7d.js:17:84241)
at async https://dev.graphite.rs/index.8fa82b7d.js:45:10725