Skip to main content

A package for extracting colours from images.

Project description


Build Status

色めく (hiragana いろめく, rōmaji iromeku) 1. to become lively 2. to become roused 3. to look arousing

Iromeku is a library to extract a colour palette from a given image.

The implementation is heavily inspired by the Stack Overflow answer here: How does the algorithm to color the song list in iTunes 11 work?

The way it works is by clustering similar colours together, based on the Euclidean distances of the pixel's value in the YUV colour space, which more closely approximates colour perception.

Getting Started

$ pip install iromeku
from iromeku import load_image, generate_clusters, get_dominant_colour

rgb_values = load_image("test.jpg")
clusters = generate_clusters(rgb_values, 0.1)
colour = get_dominant_colour(clusters)
print(colour.r, colour.g, colour.b)

0.1 in the second argument of generate_clusters refers to the threshold under which we consider two colours to be similar. Try adjusting the threshold for different results.


The library is type hinted using the comment-based syntax for backward compatibility with Python 2. Tests are run using tox.


  • [ ] Add example images
  • [ ] Add support for generating complimentary colours
  • [ ] Add support for selective sampling (e.g borders + center)
  • [ ] Improve clustering algorithm


MIT License

Project details

Release history Release notifications

This version


Download files

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

Files for iromeku, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size iromeku-0.0.1-py3-none-any.whl (7.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size iromeku-0.0.1.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page