rebuild kmean algorithm - find the closest points to match with color dots .
first install python3 and pip3 in your local machine.
run pip3 install -r requirements.txt
to install all needing packages.
run python3 imgcompress.py [name_of_file] [name_of_export_file] [number_of_color]
for example : python3 imgcompress.py a.jpg b.jpg 16
leave your image you want to compress to the same folder of python file, and the export file will be created in the same folder. you can increase or decrease the number to apporiate amount.
Before :
After