We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0188c31 commit 2d10ff9Copy full SHA for 2d10ff9
src/utils/image.js
@@ -142,7 +142,7 @@ export class RawImage {
142
throw new Error('fromCanvas() is only supported in browser environments.')
143
}
144
145
- const ctx = canvas.getContext('2d');
+ const ctx = /** @type {CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D} */ (canvas.getContext('2d'));
146
const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
147
return new RawImage(data, canvas.width, canvas.height, 4);
148
0 commit comments