I have this program which draws the Mandelbrot sets onto a canvas, and even does some creative things with the concept of it. I want this program to automatically save this canvas to my downloads folder once it's done as a .PNG file. I tried looking around this website for some help and the best thing I was able to find and somewhat understand enough to apply to my program is this:
var image = c.toDataURL("image/png").replace("image/png", "image/octet-stream");
window.location.href = image;
Where 'c' is the canvas. While this does save the image to my downloads folder, it doesn't actually store it as a PNG file. As far as I'm able to grasp it doesn't specify a filetype at all since properties of these files tell me the filetype is 'Bestand' which I'm sure is just the Dutch translation for 'file'. Does anyone know how to directly store this as a PNG file? Note: I tried opening the images in Paint and that does seem to be able to read the file. It seems to me the image is correctly saved but no filetype is specified, nor is a name of the file given at all.