diff --git a/dither-image.js b/dither-image.js index bc963dd..8db870a 100644 --- a/dither-image.js +++ b/dither-image.js @@ -240,6 +240,7 @@ function colorize(input) { let output = zeroes(width); let distance = 0; + let shortest = Infinity; let nextError = new RGB(0, 0, 0); @@ -249,7 +250,7 @@ function colorize(input) { // find the closest possible color // @todo consider doing the difference scoring in luminance and hue spaces - let shortest = Infinity; + shortest = Infinity; let pick = 1; for (let i = 0; i < palette.length; i++) { @@ -276,6 +277,7 @@ function colorize(input) { output, palette, distance, + shortest, error: error.next }; };