https://github.com/preetmishra/image-compression-kmeans
Image compression using K-Means.
https://github.com/preetmishra/image-compression-kmeans
image-compression kmeans machine-learning python
Last synced: 13 days ago
JSON representation
Image compression using K-Means.
- Host: GitHub
- URL: https://github.com/preetmishra/image-compression-kmeans
- Owner: preetmishra
- Created: 2019-07-04T06:02:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-06T18:03:21.000Z (about 6 years ago)
- Last Synced: 2024-03-30T12:40:06.807Z (over 2 years ago)
- Topics: image-compression, kmeans, machine-learning, python
- Language: Jupyter Notebook
- Homepage:
- Size: 539 KB
- Stars: 14
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Image Compression using K-Means algorithm.
The script uses K-Means, a Machine Learning clustering algorithm, to cluster all the colors in an image into 16 clusters and replace the RGB value of every pixel with the RGB value of their respective cluster center and thus reducing the amount of memory required to save a picture.
### Comparison
#### File sizes

Original Image(dog.png) | Compressed Image(dog-compressed.png)
-------------------------|-------------------------
 | 
### Requirements
- Python
- Scipy
- Numpy
- Matplotlib
### Instructions
- Download script.py in your required directory.
- Run python script.py _yourfilenamehere.png_ in your terminal.
### Note
> Use a .png file as JPEG uses lossy compression which may lead to undesired result.
## Author
- **Preet Mishra** [LinkedIn](https://www.linkedin.com/in/preetmishra)