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
Metadata
Release files for dominantcolorrecognizer 1.0.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 | Provenance | Actions |
|---|---|---|---|---|
| dominantcolorrecognizer-1.0.0.tar.gz | 209.6 kB | Without provenance | Details for dominantcolorrecognizer-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dominantcolorrecognizer-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for dominantcolorrecognizer-1.0.0-py3-none-any.whl |
Total release size: 418.7 kB
Release files / dominantcolorrecognizer-1.0.0.tar.gz
| Download URL | dominantcolorrecognizer-1.0.0.tar.gz |
|---|---|
| Size | 209.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94e4bde4d3e8b84e2fa92c92528b9ab0518831cb690c48ea4fcb03eaf9782d8a
|
|
BLAKE2b-256 checksum How to use checksums |
449c603fdda323f5b66a05a1be1e9ba957306861a9256c6306ebd415cfc06847
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.6 Windows/10
|
Release files / dominantcolorrecognizer-1.0.0-py3-none-any.whl
| Download URL | dominantcolorrecognizer-1.0.0-py3-none-any.whl |
|---|---|
| Size | 209.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45a9c7d5022919f64d2ad07dea62899ec7c3b4e9321395ef2cc8158e3e4ae95f
|
|
BLAKE2b-256 checksum How to use checksums |
774b37d7a2a2621fe586bffcf1df3077ad241c9ea3956777cb820094750f21a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.6 Windows/10
|
Security for dominantcolorrecognizer 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.