Image Compression Using K-Means Algorithm

This algorithm compresses the input image, by representing it into fewer
number of colors, which can be given as an input to the algorithm. For
e.g.,

im = io.imread("Capture.PNG")
compressed_image = kmeans(im, 16)

compressed_image will be the original image "Capture.PNG" represented
with only 16 most appropriate colors.