Replies: 4 comments 1 reply
-
|
DIN99 should be very close, although the implementation we have is slow. Do you happen to have side-by-side samples? |
Beta Was this translation helpful? Give feedback.
-
|
Don't find a comparison on his site. Would need to generate. |
Beta Was this translation helpful? Give feedback.
-
|
I evaluated the color-reduction quality using the following sample image, testing how it changes when different color spaces are used as the working space in libsixel develop branch: In both the There may still be mistakes in my implementation, so please treat the following results as reference only. I asked ChatGPT why such a large difference appears. Commented by ChatGPTEven with a perfectly correct implementation, running k-means or median cut directly in DIN99d space is inherently disadvantaged, and will almost always yield worse results than linear RGB, OKLab, or CIELAB. In short:
1. Why DIN99d and k-means / median cut fundamentally conflictThe DIN99 family aims to magnify differences in dark or highly saturated colors and make tiny ΔE differences more perceptually uniform. As a result, DIN99d’s warped axes create pathological behavior for clustering:
This leads to:
So the drop in quality is not surprising — it’s a mathematical mismatch between the metric and the algorithm. 2. Normalization issues make it even worseIf you normalize DIN99d to something like:
and feed it into the same pipeline used for OKLab/CIELAB, the distortions become amplified:
Thus, even a correct implementation tends to produce unstable, low-quality clustering. 3. If you want to use DIN99d, where should it be used?In a quantization pipeline, DIN99d works best only for distance evaluation, not as the working space. For example:
This hybrid setup avoids the global-distortion problem while still benefiting from DIN99d’s good local uniformity. 4. So is “DIN99d k-means/median cut” worth pursuing?Realistically: not much. For high-quality quantization (MS-SSIM, perceptual fidelity), making DIN99d the primary coordinate system has almost no practical upside and several inherent downsides. OKLab or CIELAB are simply better balanced for global clustering. 5. If you insist on forcing DIN99d into the working space…You’d need a lot of custom tuning, such as:
At that point it becomes clear: TL;DR
|
Beta Was this translation helpful? Give feedback.
-
|
Additionally, I tested them with the median-cut method ( |
Beta Was this translation helpful? Give feedback.




Uh oh!
There was an error while loading. Please reload this page.
-
I find the Oklab color space by Björn Ottosson seems to confer some advantages for picking 'nearness' that matches my eyes better:

Oklab color gradient
https://bottosson.github.io/posts/oklab/
Fast integer version
https://github.com/ubitux/oklab-int
https://blog.pkh.me/p/38-porting-oklab-colorspace-to-integer-arithmetic.html
Shout out to ubitux for sharing this and other fascinating info!
Beta Was this translation helpful? Give feedback.
All reactions