fromElement
API reference for the "fromElement" method.
Converts a CanvaElement into a CanvaImageBlob.

Usage

1
const { imageHelpers } = window.canva;
2
const canva = window.canva.init();
3
4
canva.onReady(async (opts) => {
5
// Convert a CanvaElement into a CanvaImageBlob
6
const image = await imageHelpers.fromElement(opts.element);
7
8
// Do something with the result
9
console.log(image);
10
});
Copied!

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>
Last modified 1mo ago
Copy link