Abstract: In this study, K-means algorithm, a distance-based clustering algorithm, is modified depending on the color quantization application. Each color cluster center is calculated as its weighted mean by using histogram value. This algorithm uses average distortion optimization strategy to improve the perceived image quality on quantized image. In this application we have also used two different color spaces like RGB and CIELab to examine the effect of color spaces on clustering. Our application supports mapping from 256-color to 16-color images to show the results.