Skip to content

Script compressing the color pallette on an image using KMeans

Notifications You must be signed in to change notification settings

voidlynx/palette_compression

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Palette Compression


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 the imgs/ folder to see the results:
difference

More examples can be seen in samples.md

About

Script compressing the color pallette on an image using KMeans

Topics

Resources

Stars

Watchers

Forks

Languages

  • Python 100.0%