This script can compress the color palette of your image using ML algorithms (KMeans and DBSCAN).\
Installation requires you to have poetry
installed via pip
, to install you need to
run poetry install
in the folder, then poetry shell
to get into the venv.
You can run this script like this:
python -m palette_compression <filename> [colors=2] [use DBSCAN=N/y]
For example:
python -m palette_compression armstrong.png 7
DBScan is broken
DBSCAN method is currently broken. Images have artifacts, if you can fix it - PLEASE drop a PR.
Here's a comparison of timings, also look in theimgs/
folder to see the results:
More examples can be seen in samples.md