Skip to main content

A package for extracting colours from images.

Project description

Iromeku

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.

Contributing

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

TODO

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

License

MIT License

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

iromeku-0.0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iromeku-0.0.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file iromeku-0.0.1.tar.gz.

File metadata

  • Download URL: iromeku-0.0.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.0

File hashes

Hashes for iromeku-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bab91c29805ef7ca5937b5f4f5a609f3b208391ca6197da2f365d6c3988a4b43
MD5 089b8e2352ccd27c7dee38854def8e32
BLAKE2b-256 ed8fa9b2596690068c6c9b263c7fab97afdaecaf07bb92c31286341390f8961d

See more details on using hashes here.

File details

Details for the file iromeku-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: iromeku-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.0

File hashes

Hashes for iromeku-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 62edc812b8ab489137943d0d535d360dc5bc9a0853b321feca52f148b4447d53
MD5 6a5f5ac07ea875fdc001d3b55641de2c
BLAKE2b-256 cfa56e0ea92ada9c12f9792ec0290ce39cc5bf0086d0ca539ec78e3adcb78487

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