I have a script that extracts the mostly commonly occurring colors from an image. I want to store this data in MySQL then be able to pull out images based on the clicking of a color. For example if the user clicks on a red color I want to pull out other images that have a high count for "red" colors. I'm not sure how to search within a range of color values or what values to actually store in the database. Ideally I'd like to present the user with a gradient band and have them click on it to find images that are close in color to what they clicked.
Any help, pointers, or keywords I can used to Google for more information would be userful.