Skip to content

Commit 12857b8

Browse files
committed
fix(RawImageDisplayArea): Use proper array type for rgba
Per ImageData documentation we need Uint8ClampedArray instead of just Uint8Array
1 parent de23267 commit 12857b8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vue-components/src/components/RawImageDisplayArea.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ export default {
5353
ctx.putImageData(imageData, 0, 0);
5454
this.hasContent = true;
5555
} else if (meta.type.includes('image/rgba32')) {
56-
const data = content.buffer
57-
? content
58-
: new Uint8Array(await content.arrayBuffer());
56+
const data = new Uint8ClampedArray(
57+
content.buffer ? content : await content.arrayBuffer()
58+
);
5959
canvas.width = meta.w;
6060
canvas.height = meta.h;
6161
const imageData = new ImageData(data, meta.w, meta.h);

0 commit comments

Comments
 (0)