//download canvas as image function downloadCanvas() { let link = document.createElement("a"); link.download = "image_name.png"; link.href = canvas.toDataURL("image/png"); link.click(); }