kinda good, highest of all chans

This commit is contained in:
Brooke Vibber 2023-03-21 06:28:03 -07:00
parent 9df948721c
commit cecd031352

View file

@ -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];