I'm trying to download the image from a canvas tag. I get from var image = canvas.toDataURL()
base64, and thought that this could be used to create a <a>
tag, and adding inside the tag download = "image.png"
and href = img
and simulate a click. I've googled around, but didn't find quite what I was looking for.
Asked
Active
Viewed 792 times
0

Lars Karlsen
- 117
- 9
-
2Possible duplicate of [Downloading Canvas element to an image](https://stackoverflow.com/questions/8126623/downloading-canvas-element-to-an-image) – 31piy Jul 26 '18 at 08:50
1 Answers
0
I found an answer actually to this question, lol.
var link = document.createElement('a');
link.href = 'images.jpg';
link.download = 'Download.jpg';
document.body.appendChild(link);
link.click();

Lars Karlsen
- 117
- 9