diff --git a/dither-image.js b/dither-image.js index d8ae0c4..e39b5ea 100644 --- a/dither-image.js +++ b/dither-image.js @@ -430,6 +430,7 @@ function decimate(input, palette, n, inputError) { if (inputError) { rgb.inc(inputError[x]); } + rgb.cap(); // find the closest possible color // @todo consider doing the difference scoring in luminance and hue spaces @@ -475,6 +476,15 @@ function decimate(input, palette, n, inputError) { let decimated = palette.slice(); + + // force to grayscale + //decimated = [0, 5, 10, 15]; + + // force to rgb + //decimated = [0, 0x36, 0xb6, 0x86]; + + // force to rWb + //decimated = [0, 0x36, 0x0f, 0x86]; while (decimated.length > n) { let {popularity, fitness, output} = dither(decimated);