diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/util.ts b/invokeai/frontend/web/src/features/controlLayers/konva/util.ts index c6e42aca27..b434b90646 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/util.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/util.ts @@ -302,10 +302,13 @@ export const konvaNodeToCanvas = (node: Konva.Node, bbox?: Rect): HTMLCanvasElem * @returns A Promise that resolves with Blob of the node cropped to the bounding box */ export const canvasToBlob = (canvas: HTMLCanvasElement): Promise => { - return new Promise((resolve) => { + return new Promise((resolve, reject) => { canvas.toBlob((blob) => { - assert(blob, 'blob is null'); - resolve(blob); + if (!blob) { + reject('Failed to convert canvas to blob'); + } else { + resolve(blob); + } }); }); };