Merge Multiple Canvases and Download as Image
I'm attempting to merge two HTML canvases into a single canvas and then download that as an image. My code is as below: function downloadCanvas() { var bottleCanvas = document.getElementById('bottleCanvas'); var designCanvas = document.getElementById('editorCanvas'); var bottleContext = bottleCanvas.getContext('2d'); bottleContext.drawImage(designCanvas, 69, 50); var dataURL = bottleCanvas.toDataURL("image/png"); var link = document.createElement('a'); link.download = "bottle-design.png"; link.href = bottleCanvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); link.click();