Skip to content
/ Palette Public

A Python utility to create color palettes based off of an image. Uses k-means clustering to generate an RGB shades palette based off of the predominant colors of the source image. User can customize the number of colors in the generated palette.

Notifications You must be signed in to change notification settings

Ubadub/Palette

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Palette

A Python utility to create color palettes based off of an image. Uses k-means clustering to generate an RGB shades palette based off of the predominant colors of the source image. User can customize the number of colors in the generated palette.

Tested for Python 3.7, but should work for Python 3.2+

How To Use

Download/clone somewhere on your computer and download the requirements in the Pipfile. Put the source image in the same directory and then run the program with python. Run it with the following command line arguments:

usage: palette.py [-h] [-s [image source]] [-n [number of colors]]

Generate a color palette based on a source image.

optional arguments:
  -h, --help            show this help message and exit
  -s [image source], --src [image source]
                        Path to the source image (default: None)
  -n [number of colors], --number [number of colors]
                        Number of colors in the palette (default: 8)

If an image source isn't provided in a command line argument, the program will ask you for one upon invocation.

Using values of n greater than ~16 will produce mediocre results. The suggested (and default) value is 8, but play around with the number depending on your source image.

In a few seconds it will display the palette, which you can then save wherever.

About

A Python utility to create color palettes based off of an image. Uses k-means clustering to generate an RGB shades palette based off of the predominant colors of the source image. User can customize the number of colors in the generated palette.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages