wip experiments (unused)
This commit is contained in:
parent
50c0f59ce6
commit
7b194147ef
1 changed files with 12 additions and 2 deletions
|
@ -651,13 +651,23 @@ function decimate(input, palette, n) {
|
||||||
rgb = rgb.multiply(brightest / avg_luma).clamp();
|
rgb = rgb.multiply(brightest / avg_luma).clamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this also works pretty ok
|
||||||
|
// but i think keeping luma is better
|
||||||
|
//
|
||||||
/*
|
/*
|
||||||
// 1) take the brightest luma
|
// 1) take the brightest luma
|
||||||
// 2) take the most saturated chroma
|
// 2) take the most saturated chroma
|
||||||
// 3) profit!
|
// 3) profit!
|
||||||
let lumas = bucket.map((rgb) => rgb.luma());
|
let lumas = bucket.map((rgb) => rgb.luma());
|
||||||
let luma = Math.max(...lumas);
|
let brightest = Math.max(...lumas);
|
||||||
let rgb = bucket[lumas.indexOf(luma)];
|
let saturations = bucket.map((rgb) => Math.max(rgb.r, rgb.g, rgb.b) - Math.min(rgb.r, rgb.g, rgb.b));
|
||||||
|
let saturation = Math.max(...saturations);
|
||||||
|
let saturatedIndex = saturations.indexOf(saturation);
|
||||||
|
let rgb = bucket[saturatedIndex];
|
||||||
|
let luma = rgb.luma();
|
||||||
|
if (luma > 0) {
|
||||||
|
rgb = rgb.multiply(brightest / luma).clamp();
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// pick the luma-brightest color in the bucket
|
// pick the luma-brightest color in the bucket
|
||||||
|
|
Loading…
Reference in a new issue