canvas to base64 string code example Example: javascript todataurl var image = new Image(); image.src = canvas.toDataURL();