K-means clustering for image compression