GithubHelp home page GithubHelp logo

color-palette's Introduction

Color Palette Generator

Generates a color palette for a given image and adds it to the bottom of the frame. The colors are selected using a K-Means clustering algorithm.

Installation instructions

  1. Install a recent version of python.
  2. Clone the repository somewhere
  3. Run the command pip install -r requirements.txt in the terminal

Running instructions

Run the following command:

python color_palette.py --file path/to/file.jpg

This will generate a new file in the same folder as your original image, but with the word _palette appended to the file name. This script should work with whatever file extensiosn that the imageio library supports. Currently the code expects 8-bit files.

You can optionally use the following arguments:

optional arguments:
  -h, --help            show this help message and exit
  --file FILE           Specify the filename of the image you want to generate a color palette for.
  --num_colors NUM_COLORS
                        Number of colors to be included in the color palette.
  --margin MARGIN       size of the white margin around the color palette (as a fraction of the size of the color chip
  --out_file OUT_FILE   Specify to override the output filepath.
  --random_colors       Use this flag to initialize kmeans with random colors
  --sample_extreme_colors
                        Experimental method that tries to subsample the input image as evenly as possible within the RGB cube, therefore removing duplicate colors.
  --hsv_initialization  Initialize KMeans using colors distributed by hue rather than by luminance
  --reduced_color_output
                        Constrain output image to the selected colors, showing which color each pixel was closest to.

color-palette's People

Contributors

thatcherfreeman avatar

Stargazers

 avatar  avatar Borislav Konstantinov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.