Image compression using K-Means algorithm.
K-Means is an Unsupervised learning algorithm that groups unlabeled dataset into different clusters.
Using the K-Means algorithm imported from sklean python library, image compression can be carried out by grouping similar colors in k-clusters. This k can be varied. Increasing the value of k reduces the size of the image at the cost of image quality. For the shared code, k has been set to 64.
For the example image uploaded inside this repository:
Initial size of the Image: 1.31 MB
Size of the Compressed Image: 0.99 MB
Image compressed by 24.43%