A python script that extract main color groups from an image using k-means clustering and returns the color harmony based on the RGB wheel
- Python 3.7+
- sklearn
- Pillow
- matplotlib
The stable releases of gallery-dl are distributed on PyPI and can be easily installed or upgraded using pip:
$ python -m pip install color-harmonyClone the repository or download the folder from github, then navigate to the respective directory and run:
python setup.py installTo use color-harmony, simply include the path to your image file:
$ color-harmony [OPTION]... [FilePATH]See also python color-harmony --help.
Default run on an image file will return both RGB colors and create a color palette image with the same name but with "_colors.png":
$ color-harmony sample.pngYou can also set the number of clusters, tolerance, and output configurations:
$ color-harmony -k 5 -t 1.5 -o text icon.pngYou will need to download the dataset from: https://www.kaggle.com/profnote/pixiv-popular-illustrations or use your own images.
Main jupyter notebook for the analysis, can use the data files below:
File containing the harmonies of each illustration in the dataset.
Column names: "Monochromatic", "Complementary", "Split Complementary", "Triad", "Square", "Rectangular", "Analogous", "Other"
Wheel color representations of each illustration in the dataset, starting from Red -> Green -> Blue -> Red.