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


Release history Release notifications

Download files

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

Files for dominantcolors, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size dominantcolors-0.1.0-py3-none-any.whl (15.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dominantcolors-0.1.0.tar.gz (3.2 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