getSize
API reference for the "getSize" 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);
// Get the size of the CanvaImageBlob
const size = await imageHelpers.getSize(image);
// Do something with the result
console.log(size);
});
Name | Type | Required | Description |
---|---|---|---|
image | CanvaImageBlob | Yes | The CanvaImageBlob to get the dimensions of. |
Promise<Size>
Name | Type | Required | Description |
---|---|---|---|
width | number | Yes | Represents a width, in pixels. |
height | number | Yes | Represents a height, in pixels. |
Last modified 1yr ago