toBlob

fun toBlob(callback: BlobCallback, type: String = definedExternally, quality: Double = definedExternally)(source)

The HTMLCanvasElement.toBlob() method creates a Blob object representing the image contained in the canvas.

MDN Reference