toDataURL

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

Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element.

Parameters

type

The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.

MDN Reference