Skip to content

@fabwcie/free-drawing / utils/export / canvasToBlob

Function: canvasToBlob() ​

canvasToBlob(canvas, type?, quality?): Promise<Blob>

Defined in: packages/free-drawing/src/utils/export.ts:377

Blob of a canvas image

Parameters ​

canvas ​

HTMLCanvasElement

rendered image (see renderCanvas)

type? ​

string = 'image/png'

Mime type of the image (png by default, jpeg for pdf)

quality? ​

number

quality of lossy formats, from 0 to 1

Returns ​

Promise<Blob>

promise of the image, rejected when the browser could not create it