How to save canvas as png image with JavaScript? Spread the love To save canvas as png image with JavaScript, we call the toDataURL method. For instance, we write window.open(canvas.toDataURL("image/png")); to call canvas.toDataURL to return a base64 string version of the canvas’ content. Related