fromDataUrl
API reference for the "fromDataUrl" method.
const { imageHelpers } = window.canva;
const canva = window.canva.init();
canva.onReady(async () => {
// Convert a data URL into a CanvaImageBlob
const image = await imageHelpers.fromDataUrl(
"image/jpeg",
"data:image/jpeg;base64,iVBORw0KGgoAA..."
);
// Do something with the result
console.log(image);
});
Name | Type | Required | Description |
---|---|---|---|
imageType | string | Yes | The MIME type of the CanvaImageBlob . The possible values are "image/jpeg" , "image/png" , and "image/svg+xml" . |
dataUrl | string | Yes | The data URL to convert into a CanvaImageBlob . |
Promise<CanvaImageBlob>
Last modified 1yr ago