https://github.com/akamhy/imagedominantcolor
Get the dominant color of any image
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.2%) to scientific vocabulary
Keywords
Repository
Get the dominant color of any image
Basic Info
- Host: GitHub
- Owner: akamhy
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://pypi.org/project/imagedominantcolor/
- Size: 35.2 KB
Statistics
- Stars: 8
- Watchers: 2
- Forks: 9
- Open Issues: 4
- Releases: 1
Topics
Metadata Files
README.md
Get the dominant color of any image
Introduction
ImageDominantColor is a Python package/library for detecting dominant color of images.
It can take any input image and tell the dominant color of the image. It doesn't use k-means clustering for detecting dominant color but instead quantizes the individual pixels and calculates the statistical mode of the quantized values.
ImageDominantColor does not depend on numpy unlike most of the other implementations for the same task and is also fast and minimalist.
What ImageDominantColor is not?
ImageDominantColor does not calculates the average color of the image. Also note that the average color of an image is not same as its dominant color.
Installation
- Using pip:
bash
pip install imagedominantcolor -U
- Install directly from GitHub:
bash
pip install git+https://github.com/akamhy/imagedominantcolor.git
Usage
```python
from imagedominantcolor import DominantColor filepath = "bluebutterfly.jpg" # Blue color is dominant dominantcolor = DominantColor(filepath) dominantcolor.dominantcolor 'b' dominantcolor.rgb (3, 6, 244) dir(dominantcolor) ['class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', 'b', 'counter', 'dominantcolor', 'dominantcolorofpixel', 'dominantcolorofpixelsofimagearray', 'g', 'generatedominantcolorofpixelsofimagearray', 'image', 'imagedata', 'imagepath', 'l', 'minimumpercentdifferenceofrgb', 'mpd', 'r', 'resizevalue', 'resizedimage', 'rgb', 'rgbl', 'setdominatcolorofimage', 'setrgblvalueofimage', 'totalpixels'] dominantcolor.totalpixels 256 dominantcolor.r 3 dominantcolor.g 6 dominantcolor.b 244 dominantcolor.l 3 dominantcolor.rgbl (3, 6, 244, 3) repr(dominantcolor) 'DominantColor(r:3 g:6 b:244 l:3; dominantcolor:b; resizevalue:16; minimumpercentdifferenceof_rgb:10)' str(dominantcolor) 'b'
```
Output dominant color and what their meanings are:
r- Red is the dominant color in the image.g- Green is the dominant color for the image.b- Blue is the dominant color.l- It is lowercase L and it implies that the image is a mostly a grayscale image. L for luminance and most of the image lacks color.n- None of the color out of r, g and b are dominant but the image is not grayscale. It implies that the image has equal regions where 2 or 3 colors dominate, example here. You can check the rgb attribute to decide what to do with such cases.
What are r, g, b and l attributes of DominantColor objects?
The library shrinks the image before checking the dominant color and the default resize value is 256. Thus every image is shrunk to a 256 pixels image. The r,g,b and l attributes indicate the number of pixels which have r,g,b and l as dominating value.
License
Copyright (c) 2022 Akash Mahanty.
Released under the MIT License. See license for details.
Owner
- Name: Akash Mahanty
- Login: akamhy
- Kind: user
- Location: Delhi, India
- Website: https://akamhy.me
- Twitter: _AkashMahanty
- Repositories: 5
- Profile: https://github.com/akamhy
~
GitHub Events
Total
- Watch event: 1
- Pull request event: 1
- Fork event: 2
Last Year
- Watch event: 1
- Pull request event: 1
- Fork event: 2
Committers
Last synced: almost 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Akash Mahanty | a****y@y****m | 31 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 3
- Total pull requests: 5
- Average time to close issues: 22 minutes
- Average time to close pull requests: 1 minute
- Total issue authors: 3
- Total pull request authors: 3
- Average comments per issue: 2.67
- Average comments per pull request: 1.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- fmotion1 (1)
- akamhy (1)
- ShivamA96 (1)
Pull Request Authors
- Demmenie (4)
- jerrecode (2)
- albertopasqualetto (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- pypi 10,871 last-month
- Total docker downloads: 36
-
Total dependent packages: 1
(may contain duplicates) -
Total dependent repositories: 1
(may contain duplicates) - Total versions: 3
- Total maintainers: 1
pypi.org: imagedominantcolor
Find dominant aka most common color of any image.
- Homepage: https://akamhy.github.io/imagedominantcolor/
- Documentation: https://imagedominantcolor.readthedocs.io/
- License: MIT
-
Latest release: 1.0.1
published about 4 years ago
Rankings
Maintainers (1)
conda-forge.org: imagedominantcolor
- Homepage: https://akamhy.github.io/imagedominantcolor/
- License: MIT
-
Latest release: 1.0.1
published over 3 years ago
Rankings
Dependencies
- black * test
- codecov * test
- flake8 * test
- mypy * test
- pytest * test
- pytest-cov * test
- types-pillow * test
- Pillow *
- Pillow *
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite