-
Notifications
You must be signed in to change notification settings - Fork 138
Description
I was trying a few things to get better results and found out transforming to YDbDr (which encodes blue/red chroma as the difference to luma), quantizing and remapping, then transforming back to sRGB preserves more color detail especially when requesting very low color counts.
Here are some of my 16-color results, which I obtained by using ImageMagick’s API to transform to YDbDr, passing it through libimagequant as if it were RGB, and reversing the color transformation.
| original | unmodified | via YDbDr |
|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Of course this doesn’t always yield pretty results:
| original | unmodified | via YDbDr |
|---|---|---|
![]() |
![]() |
![]() |
However, there’s one more trick we can use in special cases: sigmoidal contrast adjustment before and after quantization (I did that in Oklch colorspace for this example).
| unmodified | via YDbDr | sigmoidal contrast |
|---|---|---|
![]() |
![]() |
![]() |
Just leaving this here as inspiration 🙂
With a custom color transform it might be possible to turn it into a color weighting option or something. I also haven’t tried playing with importance maps yet.















