toImageElement

API reference for the "toImageElement" method.

Converts a CanvaImageBlob into an HTMLImageElement.

Usage

const { imageHelpers } = window.canva;
const canva = window.canva.init();
‚Äč
canva.onReady(async (opts) => {
const img = await imageHelpers.toImageElement(opts.image);
console.log(img);
});

Parameters

Name

Type

Required

Description

image

CanvaImageBlob

Yes

The CanvaImageBlob to convert into an HTMLImageElement.

Returns

Promise<HTMLImageElement>