diff --git a/dither-image.js b/dither-image.js index c6f2348..080ad74 100644 --- a/dither-image.js +++ b/dither-image.js @@ -587,7 +587,15 @@ function decimate(input, palette, n, inputError, y) { //let rgb = bucket.slice().sort((a, b) => b.luma() - a.luma())[bucket.length - 1]; // Take the median color in the bucket - let rgb = bucket[bucket.length >> 1]; + //let rgb = bucket[bucket.length >> 1]; + + // Combine the brightest of each channel + // this is kinda good + let rgb = new RGB( + Math.max(...bucket.map((rgb) => rgb.r)), + Math.max(...bucket.map((rgb) => rgb.g)), + Math.max(...bucket.map((rgb) => rgb.b)) + ); // Take the luma-median color in the bucket //let rgb = bucket.slice().sort((a, b) => b.luma() - a.luma())[bucket.length >> 1];