/k-means-color-quantization

This repository contains an implementation of the K-Means clustering algorithm for performing image quantization. The goal is to reduce the number of colors in an image while preserving its overall visual appearance. The code is written in a programming language and provides an easy-to-use interface for performing color quantization on images.

Primary LanguagePythonMIT LicenseMIT

K-Means Color Quantization

Example of K-Means color quantization. It performs pixel-wise replacements on the image based on the number of clusters defined with K-Means.

It's a basic form of compression where it can reduce the storage space.

Execution

The program can be run by simply using this command

python main.py -f sample/cliff.jpg
python main.py -f sample/house.jpg

Clicking the "Save" button will compress the image into the custom format (saved under the sample directory).

Decompression

In order to visualize the compressed image you can run

python compress.py -f sample/PATH_TO_IMAGE