Skip to main content

A module to grab dominant colors from image

Project description

Dominant Colors

A python module for grabbing dominant colors from an image. It's much faster than colorthief.

Installation

pip install dominantcolors

Usage

from dominantcolors import get_image_dominant_colors
dominant_colors = get_image_dominant_colors(image_path='/path/to/image_path',num_colors=3)

Performance

import time
from colorthief import ColorThief
from dominantcolors import get_image_dominant_colors

image_path = 'examples/image.jpg'
start_time = time.time()
color_thief = ColorThief(image_path)
dominant_colors = color_thief.get_palette(3, quality=1)
print('colorthief uses %s seconds.' % (time.time() - start_time))
#OUTPUT: colorthief uses 1.2148401737213135 seconds.

start_time = time.time()
dominant_colors = get_image_dominant_colors(image_path, 3)
print('dominantcolors uses %s seconds.' % (time.time() - start_time))
#OUPUT: dominantcolors uses 0.11298108100891113 seconds.

Thanks

Thanks to AI Shack for its original tutorial.

Better

If you feel anything wrong, feedback or pull requests are welcome.

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

dominantcolors-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

dominantcolors-0.1.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file dominantcolors-0.1.0.tar.gz.

File metadata

  • Download URL: dominantcolors-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.19.6 CPython/3.6.4

File hashes

Hashes for dominantcolors-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4252d633bf1f5835bf33b0ca9f341db9ec15a431c767c48ca1a29a629149e5cf
MD5 1b8f1c0cc52ac3d6268bec5a75ddc9a2
BLAKE2b-256 2bc16e850d42e3d03c10f856e6a5ee5fd2da95f44e5be04ffeb5e08944e69cc9

See more details on using hashes here.

File details

Details for the file dominantcolors-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dominantcolors-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.19.6 CPython/3.6.4

File hashes

Hashes for dominantcolors-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 994ab5ac1d4a9e199bcce820f784c341d6c3c0afea633f5d2cf12471af6756c0
MD5 fba6217fc6266414b6f03eac921b4d45
BLAKE2b-256 50f328d0a19a5c769dd6df9fd52c907cf1f22b26bfd88c5245f2633d71336e85

See more details on using hashes here.

Supported by

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