https://github.com/akamhy/imagedominantcolor

Get the dominant color of any image

https://github.com/akamhy/imagedominantcolor

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

dominant-color dominant-colors most-common-color most-dominant-color pypi-package python python-library python3
Last synced: 6 months ago · JSON representation

Repository

Get the dominant color of any image

Basic Info
Statistics
  • Stars: 8
  • Watchers: 2
  • Forks: 9
  • Open Issues: 4
  • Releases: 1
Topics
dominant-color dominant-colors most-common-color most-dominant-color pypi-package python python-library python3
Created about 4 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md


Get the dominant color of any image

Build Status codecov pypi Downloads PyPI - Python Version Code style: black

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

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

License: MIT

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

~

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

All Time
  • Total Commits: 31
  • Total Committers: 1
  • Avg Commits per committer: 31.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email 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.

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 10,871 Last month
  • Docker Downloads: 36
Rankings
Docker downloads count: 3.3%
Downloads: 3.9%
Dependent packages count: 10.1%
Average: 13.2%
Forks count: 15.4%
Dependent repos count: 21.5%
Stargazers count: 25.1%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: imagedominantcolor
  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent packages count: 28.8%
Dependent repos count: 34.0%
Average: 45.6%
Stargazers count: 58.4%
Forks count: 61.1%
Last synced: 6 months ago

Dependencies

requirements-test.txt pypi
  • black * test
  • codecov * test
  • flake8 * test
  • mypy * test
  • pytest * test
  • pytest-cov * test
  • types-pillow * test
requirements.txt pypi
  • Pillow *
setup.py pypi
  • Pillow *
.github/workflows/ci_linux.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite