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 c72ee89 commit bbb2f74Copy full SHA for bbb2f74
lib/png/pngEncoder.js
@@ -73,10 +73,12 @@ PngEncoder.prototype.writeTrueColorWithAlpha = function PngEncoder_writeTrueColo
73
74
for (var x = 0; x < width; canvasCursor++) {
75
var count = colorRanges[canvasCursor * 2 + 0];
76
- var color = colorRanges[canvasCursor * 2 + 1];
+
77
+ // Use a bitwise operator to ensure the color is expressed as a signed 32-bit integer
78
+ var color = colorRanges[canvasCursor * 2 + 1] & 0xffffffff;
79
80
for (var i = 0; i < count; i++) {
- buffer.writeUInt32BE(color, outputCursor, true);
81
+ buffer.writeInt32BE(color, outputCursor);
82
outputCursor += 4;
83
}
84
0 commit comments