diff --git a/dither-image.js b/dither-image.js index 17efe94..fb5130e 100644 --- a/dither-image.js +++ b/dither-image.js @@ -489,6 +489,8 @@ function decimate(input, palette, n, inputError) { let reserved = [0]; // black //let reserved = [0, 15]; // black, white //let reserved = [0, 5, 10, 15]; // grayscale + //let reserved = [0, 0x48, 0x78, 15]; // vaporwave + //let reserved = [0, 0x3c, 0x78, 15]; // red/blue/white let keepers = new Uint8Array(256); for (let i of reserved) { @@ -508,18 +510,7 @@ function decimate(input, palette, n, inputError) { } //let coolFactor = popularity[i]; - - let coolFactor = 0; - if (popularity[i]) { - for (let x = 0; x < width; x++) { - if (output[x] == i) { - // Scale up the scoring for close matches to prioritize - // color accuracy over raw linear usage. - //coolFactor += (fitness[x] ** 2); - coolFactor += (fitness[x] ** 4); - } - } - } + let coolFactor = (fitness[i] ** 2) * popularity[i]; if (coolFactor < least) { pick = i;