No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Pekka Väänänen abc4208f36 topdown_cut: add BestPCA method
Often identical results to ExactPC1 though
2026-03-14 12:21:44 +02:00
.vscode cli: accept enum names instead of values 2026-01-07 17:59:15 +02:00
datafiles add icon 2026-01-07 17:59:14 +02:00
docs readme: screenshot and description 2026-01-07 18:14:09 +02:00
reqs add ruff to dev reqs 2026-01-07 17:59:14 +02:00
src topdown_cut: add BestPCA method 2026-03-14 12:21:44 +02:00
testdata add testdata/braennoe1_transparent.png 2026-01-07 17:59:14 +02:00
tests rename MaxVarianceAxis to BestAxisAligned 2026-01-07 17:59:15 +02:00
.gitignore ignore output dir 2026-01-07 17:59:14 +02:00
LICENSE add MIT license 2026-01-07 18:15:38 +02:00
README.md readme: screenshot and description 2026-01-07 18:14:09 +02:00
variquant.py support --trace on the cli 2026-01-07 17:59:15 +02:00

VariQuant

An experimental tool for interactive color quantization.

Screenshot

This is alpha-quality software.

Known issues

  • Program doesn't start without an image. Pass in an image path as a command line argument.
  • Pixel mapping implementation can consume hundreds of megs of peak RAM
  • HyAB distance is broken with most color space combinations

Algorithms

This program runs a divisive (top-down) hierarchical clustering pass over the colors and then refines the result with k-means. It's designed for flexibility and correctness; not for performance. That's why it's practical to run only for small images.

Most of the magic is in the file src/topdown_cut.py. See my book for details.

Command line

There's a command line interface that's enabled via the --no-gui argument. Run python variquant.py --help for details.

Installation

pip install -r reqs/requirements.txt

For development

First make sure you have pip-tools installed. Then run pip-sync:

pip-sync reqs/requirements.txt reqs/requirements.dev.txt

To update requirements.dev.txt after adding a dependency:

pip-compile reqs/requirements.in > reqs/requirements.txt
pip-compile reqs/requirements.dev.in > reqs/requirements.dev.txt