Fix loop condition in dithering function

This commit is contained in:
Jasper van Loenen
2026-01-19 17:01:04 +01:00
committed by GitHub
parent 1b18f6e8f9
commit 47a367f6d0
+1 -1
View File
@@ -41,7 +41,7 @@ function dithering(ctx, width, height, threshold, typeIndex) {
let newPixel; let
err;
for (let currentPixel = 0; currentPixel <= imageDataLength; currentPixel += 4) {
for (let currentPixel = 0; currentPixel < imageDataLength; currentPixel += 4) {
if (type === 'binary') {
// No dithering
imageData.data[currentPixel] = imageData.data[currentPixel] < threshold ? 0 : 255;