canvas as image code example
Example 1: javascript todataurl
var image = new Image();
image.src = canvas.toDataURL();
Example 2: convert canvas to DataUrl and insert image in google sheet
function savejSigToSht() {
var dataURL = canvas.toDataURL('image/png');
google.script.run.insertSig(dataURL);
google.script.host.close();
}