Possible Duplicate:
How to reduce color palette with PIL
I'm trying to create a program that can identify similar images based off common colors. I've been experimenting with histograms and some of the filters in PIL but I feel like I'm reinventing the wheel. So:
How can I reduce an image to X number of colors?