how to convert canvas into jpg code example
Example: how to convert a html canvas into a png file
let canvas = document.getElementById("mycanvas");
let img = canvas.toDataURL("image/png");
document.write('<img src="'+img+'"/>');
let canvas = document.getElementById("mycanvas");
let img = canvas.toDataURL("image/png");
document.write('<img src="'+img+'"/>');