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.
Release files for dominantcolors 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dominantcolors-0.1.0.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dominantcolors-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.9 kB
Release files / dominantcolors-0.1.0.tar.gz
| Download URL | dominantcolors-0.1.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4252d633bf1f5835bf33b0ca9f341db9ec15a431c767c48ca1a29a629149e5cf
|
|
BLAKE2b-256 checksum How to use checksums |
2bc16e850d42e3d03c10f856e6a5ee5fd2da95f44e5be04ffeb5e08944e69cc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / dominantcolors-0.1.0-py3-none-any.whl
| Download URL | dominantcolors-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
994ab5ac1d4a9e199bcce820f784c341d6c3c0afea633f5d2cf12471af6756c0
|
|
BLAKE2b-256 checksum How to use checksums |
50f328d0a19a5c769dd6df9fd52c907cf1f22b26bfd88c5245f2633d71336e85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|