{"id":17972404,"url":"https://github.com/akamhy/imagedominantcolor","last_synced_at":"2025-07-27T22:32:36.048Z","repository":{"id":60722472,"uuid":"453973323","full_name":"akamhy/imagedominantcolor","owner":"akamhy","description":"Get the dominant color of any image","archived":false,"fork":false,"pushed_at":"2024-07-02T20:12:35.000Z","size":36,"stargazers_count":6,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-29T14:56:37.115Z","etag":null,"topics":["dominant-color","dominant-colors","most-common-color","most-dominant-color","pypi-package","python","python-library","python3"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/imagedominantcolor/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akamhy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-31T11:06:09.000Z","updated_at":"2024-09-02T11:03:01.000Z","dependencies_parsed_at":"2022-10-03T21:01:52.094Z","dependency_job_id":null,"html_url":"https://github.com/akamhy/imagedominantcolor","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akamhy%2Fimagedominantcolor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akamhy%2Fimagedominantcolor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akamhy%2Fimagedominantcolor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akamhy%2Fimagedominantcolor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akamhy","download_url":"https://codeload.github.com/akamhy/imagedominantcolor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227843582,"owners_count":17827986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dominant-color","dominant-colors","most-common-color","most-dominant-color","pypi-package","python","python-library","python3"],"created_at":"2024-10-29T16:14:38.086Z","updated_at":"2024-12-03T02:59:02.107Z","avatar_url":"https://github.com/akamhy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/akamhy/imagedominantcolor/main/assets/image_dominant_color_logo.svg\" width=\"300\"\u003e\u003cbr\u003e\n\u003ch3\u003eGet the dominant color of any image\u003c/h3\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/akamhy/imagedominantcolor/actions?query=workflow%3ATest\"\u003e\u003cimg alt=\"Build Status\" src=\"https://github.com/akamhy/imagedominantcolor/workflows/Test/badge.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/akamhy/imagedominantcolor\"\u003e\u003cimg alt=\"codecov\" src=\"https://codecov.io/gh/akamhy/imagedominantcolor/branch/main/graph/badge.svg?token=xCV7vQ9MJo\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/imagedominantcolor/\"\u003e\u003cimg alt=\"pypi\" src=\"https://img.shields.io/pypi/v/imagedominantcolor.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pepy.tech/project/imagedominantcolor?versions=1*\"\u003e\u003cimg alt=\"Downloads\" src=\"https://pepy.tech/badge/imagedominantcolor/month\"\u003e\u003c/a\u003e\n\u003ca href=\"#\"\u003e\u003cimg alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/imagedominantcolor?style=flat-square\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/psf/black\"\u003e\u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n### Introduction\nImageDominantColor is a Python package/library for **detecting dominant color of images**.\n\nIt 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.\n\nImageDominantColor does not depend on numpy unlike most of the other implementations for the same task and is also fast and minimalist.\n\n\nWhat ImageDominantColor is not?\n\u003e 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.\n\n\n### Installation\n\n  - Using [pip](https://en.wikipedia.org/wiki/Pip_(package_manager)):\n\n```bash\npip install imagedominantcolor -U\n```\n\n  - Install directly from GitHub:\n\n```bash\npip install git+https://github.com/akamhy/imagedominantcolor.git\n```\n\n\n### Usage\n```python\n\u003e\u003e\u003e from imagedominantcolor import DominantColor\n\u003e\u003e\u003e file_path = \"blue_butterfly.jpg\" # Blue color is dominant\n\u003e\u003e\u003e dominantcolor = DominantColor(file_path)\n\u003e\u003e\u003e dominantcolor.dominant_color\n'b'\n\u003e\u003e\u003e dominantcolor.rgb\n(3, 6, 244)\n\u003e\u003e\u003e dir(dominantcolor)\n['__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', 'dominant_color', 'dominant_color_of_pixel', 'dominant_color_of_pixels_of_image_array', 'g', 'generate_dominant_color_of_pixels_of_image_array', 'image', 'image_data', 'image_path', 'l', 'minimum_percent_difference_of_rgb', 'mpd', 'r', 'resize_value', 'resized_image', 'rgb', 'rgbl', 'set_dominat_color_of_image', 'set_rgbl_value_of_image', 'total_pixels']\n\u003e\u003e\u003e dominantcolor.total_pixels\n256\n\u003e\u003e\u003e dominantcolor.r\n3\n\u003e\u003e\u003e dominantcolor.g\n6\n\u003e\u003e\u003e dominantcolor.b\n244\n\u003e\u003e\u003e dominantcolor.l\n3\n\u003e\u003e\u003e dominantcolor.rgbl\n(3, 6, 244, 3)\n\u003e\u003e\u003e repr(dominantcolor)\n'DominantColor(r:3 g:6 b:244 l:3; dominant_color:b; resize_value:16; minimum_percent_difference_of_rgb:10)'\n\u003e\u003e\u003e str(dominantcolor)\n'b'\n\u003e\u003e\u003e\n```\n\nOutput dominant color and what their meanings are:\n\n  - `r` - Red is the dominant color in the image.\n  - `g` - Green is the dominant color for the image.\n  - `b` - Blue is the dominant color.\n  - `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  - `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](https://user-images.githubusercontent.com/64683866/151845374-dd1a83e5-3265-491e-830d-39be120af65b.png). You can check the rgb attribute to decide what to do with such cases.\n\nWhat are `r`, `g`, `b` and `l` attributes of `DominantColor` objects?\n\u003e 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.\nThe r,g,b and l attributes indicate the number of pixels which have r,g,b and l as dominating value.\n\n### License\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/akamhy/imagedominantcolor/blob/main/LICENSE)\n\nCopyright (c) 2022 Akash Mahanty.\n\nReleased under the MIT License. See\n[license](https://github.com/akamhy/imagedominantcolor/blob/main/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakamhy%2Fimagedominantcolor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakamhy%2Fimagedominantcolor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakamhy%2Fimagedominantcolor/lists"}