Skip to main content

Automatic color palette detection

Project description

# colorific

Image palette detection in Python modelled after Paul Annesley's color
detector in PHP. `colorific` determines what the most important colors
used in your image are, and if one of them is a background color.

_by Dennis Hotson & Lars Yencken_

## Usage

`colorific` is meant to run in a streaming manner. You can run it on a single image by echo'ing in the image:

$ echo myimage.png | colorific
myimage.png #3e453f,#2ea3b7,#bee6ea,#51544c,#373d38 #ffffff

Each input line should be a filename. Each output line will be a tab-delimited
string containing the filename, major colors in order, and (optionally) a
detected background color.

To run on an entire directory tree of images::

$ find . -name '*.jpg' | colorific

For a small amount of images, `colorific` can also be invoked with the image file names provided as arguments:

$ colorific myimage.png
myimage.png #3e453f,#2ea3b7,#bee6ea,#51544c,#373d38 #ffffff

`colorific` has an experimental multiprocessing mode, accessed by the `-n`
argument. For example, to run the same example using 8 processes::

$ find . -name '*.jpg' | colorific -p 8

You can also get usage information by running `colorific --help`.

## Example

Here's a concrete example of use. This is the NASA Ares logo:

![NASA Ares Logo](http://media.quietlyamused.org.s3.amazonaws.com/palette/500px-NASA-Ares-logo.svg.png)

Let's run palette detection on it:

$ echo 500px-NASA-Ares-logo.svg.png | colorific
500px-NASA-Ares-logo.svg.png #0065b9,#bbd6ec,#ff0000

These correspond to the colors:

![Ares palette](http://media.quietlyamused.org.s3.amazonaws.com/palette/ares-palette.png)

Note that black and white have been stripped away, and minor colors introduced
through antialiasing are not present.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colorific-0.2.1.tar.gz (5.7 kB view details)

Uploaded Source

File details

Details for the file colorific-0.2.1.tar.gz.

File metadata

  • Download URL: colorific-0.2.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for colorific-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0f1e5d85aecbbfbe9895f3eb43f72379c3862db95284e600ff680d0ea75025bb
MD5 d8248e8ba23484fc9b7678fe3fe7be88
BLAKE2b-256 0323fa02ee60b87a1520fbf65ff4ac0c27841722ee794e34d176896ab55a68e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page