/paletti

A library for automatically extracting color palettes from images

Primary LanguagePythonMIT LicenseMIT

paletti

A library for extracting color palettes from images.

paletti provides four different ways for automatic color palette extraction from images and image URLs.

  • A wrapper around PIL's adaptive palette conversion.
  • A wrapper for the pictaculous API.
  • A wrapper for the colorific palette extraction library (© 2012, 99designs).
  • A k-means color palette extraction using scikit-learn. Additionally creates a color-reduced image with the palette colors.

Installation

Requirements: numpy

python setup.py install

Usage examples

Extract a 5-color palette from a local image using the PIL method:

paletti -m pil -k 5 -o <IMAGE_FILE>

Extract a 3-color palette from an image URL using k-means:

paletti -m k-means -k 3 -o -u <IMAGE_URL>

Type paletti --help for all available options.

Example outputs

  • Input image:

alt tag

The extracted colors are print as a pretty table to stdout:

alt tag

If the output tag is set, the palette is saved as an image:

  • PIL palette

alt tag

  • Colorific palette

alt tag

  • Pictaculous palette

alt tag

  • K-Means palette

alt tag

  • The color-reduced image (k=5) computed when choosing k-means as method alt tag