I have been trying to download a snapshot of a canvas using the code below:
var strMime = "image/png";
var canvas = document.getElementsByTagName('canvas')[0];
var link = document.createElement("a");
link.href = canvas.toDataURL(strMime);
link.download = 'test1.png';
link.click();
However, I'm facing an issue where the image generated has a white background instead of being transparent as intended, even when setting the canvas style background color to be transparent.
Does anyone have any ideas on how to generate transparent PNG files from a canvas?