File: readme.md

package info (click to toggle)
golang-github-soniakeys-quant 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 140 kB
  • sloc: makefile: 2
file content (17 lines) | stat: -rw-r--r-- 915 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Mean
====

A simple color quantizer.  Similar to a median cut algorithm execept it uses
the mean rather than the median.  While the median seems technically correct
the mean seems good enough and is easier to compute.  This implementation is
also simplified over traditional median cut algorithms by replacing the
priority queue with a simple linear search.  For a typical number of colors
(256) a linear search is fast enough and does not represent a significant
inefficiency.

A bit of sophistication added though is a two stage clustering process.
The first stage takes a stab at clipping tails off the distributions of colors
by pixel population, with the goal of smoother transitions in larger areas of
lower color density.  The second stage attempts to allocate remaining palette
entries more uniformly.  It prioritizes by a combination of pixel population
and color range and splits clusters at mean values.