algolia / color-extractor

Extract the dominant color(s) of your fashion articles!
https://algolia.com
Other
279 stars 69 forks source link

Getting top 5 colors of the image #4

Open shabnambanu1983 opened 7 years ago

shabnambanu1983 commented 7 years ago

Hi, I am trying out the command line tool. how to use the ./color-extractor CLI tool to get the top 5 colors of my image along with their frequencies. I am able to get only one. Also please provide me the json file format for --settings option. I tried to provide 'all' option to the selector but could not make it work. Also please let me know how to pass settings while using the library from python code.

Thanks, Shabnam

shabnambanu1983 commented 7 years ago

I would also need the RGB values of the top 5 colors

neepaw commented 6 years ago

@shabnambanu1234 Go to your cluster.py file and in the method _default_settings(), set the value of "min_k" equal to the number of colors you want. Then it will return top 'min_k' colours. But if your image has fewer colours than 'min_k' in that case, you will get less number of colours. Example:

def _default_settings():
        return {
            'min_k': 5,
            'max_k': 10,
            'algorithm': 'kmeans',
        }