Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.

Commit acbeceb

Browse files
committed
Use a loop to copy png image data instead of Buffer.copy
1 parent ffdda49 commit acbeceb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/image/png.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ class PNGImage {
118118
let i = p = a = 0;
119119
const len = pixels.length;
120120
while (i < len) {
121-
pixels.copy(imgData, p, i, i + colorCount);
122-
p += colorCount;
123-
i += colorCount;
121+
for (let colorIndex = 0; colorIndex < colorCount; colorIndex++) {
122+
imgData[p++] = pixels[i++];
123+
}
124124
alphaChannel[a++] = pixels[i++];
125125
}
126126

0 commit comments

Comments
 (0)