toDataURL

fun toDataURL(type: String = definedExternally, quality: Double = definedExternally): String(source)

The HTMLCanvasElement.toDataURL() method returns a data URL containing a representation of the image in the format specified by the type parameter.

MDN Reference