Skip to main content

Python library created to obtain a specific number of dominant colors from an image.

Project description

Dominant Color Recognizer

General info

DCR is a Python library created to obtain a specific number of dominant colors from image. You can define number of colors and color model in which values will be returned.

Currently supported color models:

Color model Example
HEX #0040ff
RGB rgb(0, 64, 255)

Instalation

Use the package manager pip to install DCR library:

pip install dominantcolorrecognizer

Usage

from dominant_color_recognizer import ColorAnalyzer, RGBColorModel, HEXColorModel

# RGB color model:
print(ColorAnalyzer(RGBColorModel()).get_dominant_colors('test.jpg', 3))
# You can also use URL
print(ColorAnalyzer(RGBColorModel()).get_dominant_colors('https://swiatkolorow.com.pl/userdata/public/gfx/252817/1ee9698f09e987d3e9a3785167b180b0.jpg', 3))
# Expected result:
# ["(185, 154, 90)", "(52, 40, 24)", "(25, 18, 0)"]

# HEX color model:
print(ColorAnalyzer(HEXColorModel()).get_dominant_colors('test.jpg', 3))
# Same as with RGB, you can also use URL
print(ColorAnalyzer(HEXColorModel()).get_dominant_colors('https://swiatkolorow.com.pl/userdata/public/gfx/252817/1ee9698f09e987d3e9a3785167b180b0.jpg', 3))
# Expected result:
# ['#B99A5A', '#342818', '#191200']

Tests

To run a tests you have to install pytest and run it with the command:

pytest

License

Bittapps

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

dominantcolorrecognizer-0.2.5.tar.gz (506.7 kB view details)

Uploaded Source

Built Distribution

dominantcolorrecognizer-0.2.5-py3-none-any.whl (587.5 kB view details)

Uploaded Python 3

File details

Details for the file dominantcolorrecognizer-0.2.5.tar.gz.

File metadata

  • Download URL: dominantcolorrecognizer-0.2.5.tar.gz
  • Upload date:
  • Size: 506.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.6 Windows/10

File hashes

Hashes for dominantcolorrecognizer-0.2.5.tar.gz
Algorithm Hash digest
SHA256 7af45b353002fc11bc8ef2cc41c2889223222d20a35b29ac3f586ba7e525533b
MD5 19b3d45839db18c3c51c49865bbb0263
BLAKE2b-256 f0c01aad35adb98a274f7cdef5624d98e7523c4ef3174164eda8d5172731d90e

See more details on using hashes here.

File details

Details for the file dominantcolorrecognizer-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for dominantcolorrecognizer-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 167ce3f6aba2fe76d267475cf4b586575f9a4c906e974c3936727181b8e003fe
MD5 5321e6b873e9bf24be99b05aced11a6f
BLAKE2b-256 947ac12c81f67bbb0a3b005f135aece7b15660b9de7c43807d9b1fc8c9c07e42

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