mirror of
https://github.com/javl/image2cpp.git
synced 2026-07-28 04:05:35 +00:00
Fix loop condition in dithering function
This commit is contained in:
+1
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user