toImageElement
API reference for the "toImageElement" method.
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);
// Convert the CanvaImageBlob into an HTMLImageElement
const img = await imageHelpers.toImageElement(image);
// Do something with the result
console.log(img);
});
Name | Type | Required | Description |
---|---|---|---|
image | CanvaImageBlob | Yes | The CanvaImageBlob to convert into an HTMLImageElement . |
Promise<HTMLImageElement>
Last modified 1yr ago