fromElement

API reference for the "fromElement" method.

Converts a CanvaElement into a CanvaImageBlob.

Usage

const { imageHelpers } = window.canva;
const canva = window.canva.init();
canva.onReady(async (opts) => {
// Convert a CanvaElement into a CanvaImageBlob
const image = await imageHelpers.fromElement(opts.element);
// Do something with the result
console.log(image);
});

Parameters

Name

Type

Required

Description

element

CanvaElement

Yes

The CanvaElement to convert into a CanvaImageBlob.

quality

string

No

The quality of the image. The possible values are "thumbnail", "preview", and "full". The default value is "full".

Returns

Promise<CanvaImageBlob | undefined>