diff --git a/src/util.ts b/src/util.ts index d418b621..516616e3 100644 --- a/src/util.ts +++ b/src/util.ts @@ -183,8 +183,11 @@ export function canvasToBlob( export function createImage(url: string): Promise { return new Promise((resolve, reject) => { const img = new Image() - img.decode = () => resolve(img) as any - img.onload = () => resolve(img) + img.onload = () => { + img.decode().then(() => { + requestAnimationFrame(() => resolve(img)) + }) + } img.onerror = reject img.crossOrigin = 'anonymous' img.decoding = 'async'