getdominantcolor


Namegetdominantcolor JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/getdominantcolor
SummaryExtracts the dominant color from an image represented by an array.
upload_time2023-11-29 00:39:43
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords rgb find
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Extracts the dominant color from an image represented by an array.

## pip install getdominantcolor

### Tested against Windows / Python 3.11 / Anaconda




```python

Parameters:
- x (numpy.ndarray): The input image represented as a NumPy array with shape (height, width, channels - 3).

Returns:
tuple: A tuple representing the dominant color in the RGB format (red, green, blue).

The function reshapes the input array to a two-dimensional array and calculates a numerical code for each pixel
based on its RGB values. The dominant color is then determined by counting the occurrences of these codes and
returning the RGB values of the code with the highest frequency.

Example:
	from getdominantcolor import get_dom_color
	import numpy as np
	np.random.seed(0)
	x = np.random.randint(0, 255, (4000, 4000, 3))
	get_dom_color(x)
	# (81, 101, 238)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/getdominantcolor",
    "name": "getdominantcolor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "rgb,find",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/35/ff/6e35ec7850684b758e4468b817e95924f10689d7d6c61d72c127021e4e7e/getdominantcolor-0.10.tar.gz",
    "platform": null,
    "description": "\r\n# Extracts the dominant color from an image represented by an array.\r\n\r\n## pip install getdominantcolor\r\n\r\n### Tested against Windows / Python 3.11 / Anaconda\r\n\r\n\r\n\r\n\r\n```python\r\n\r\nParameters:\r\n- x (numpy.ndarray): The input image represented as a NumPy array with shape (height, width, channels - 3).\r\n\r\nReturns:\r\ntuple: A tuple representing the dominant color in the RGB format (red, green, blue).\r\n\r\nThe function reshapes the input array to a two-dimensional array and calculates a numerical code for each pixel\r\nbased on its RGB values. The dominant color is then determined by counting the occurrences of these codes and\r\nreturning the RGB values of the code with the highest frequency.\r\n\r\nExample:\r\n\tfrom getdominantcolor import get_dom_color\r\n\timport numpy as np\r\n\tnp.random.seed(0)\r\n\tx = np.random.randint(0, 255, (4000, 4000, 3))\r\n\tget_dom_color(x)\r\n\t# (81, 101, 238)\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Extracts the dominant color from an image represented by an array.",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/getdominantcolor"
    },
    "split_keywords": [
        "rgb",
        "find"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8c4b3b9d65b9894426d4889733061d77b45ddd7a4de862afe5f61ee291ad38b7",
                "md5": "d6e8e71f6392c6233c812c6d338bc28e",
                "sha256": "274b3283c80f239ba1d7954dc40eae36f8684e32a9a61bceb658a9d9a0139315"
            },
            "downloads": -1,
            "filename": "getdominantcolor-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6e8e71f6392c6233c812c6d338bc28e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 20866,
            "upload_time": "2023-11-29T00:39:41",
            "upload_time_iso_8601": "2023-11-29T00:39:41.586419Z",
            "url": "https://files.pythonhosted.org/packages/8c/4b/3b9d65b9894426d4889733061d77b45ddd7a4de862afe5f61ee291ad38b7/getdominantcolor-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "35ff6e35ec7850684b758e4468b817e95924f10689d7d6c61d72c127021e4e7e",
                "md5": "f14bddb12d2598b7c0e4ee1403ad3225",
                "sha256": "65730cfd12812fb34f36f13d78394e046b4b4a55828837e013549cc7ec20d71d"
            },
            "downloads": -1,
            "filename": "getdominantcolor-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "f14bddb12d2598b7c0e4ee1403ad3225",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 20061,
            "upload_time": "2023-11-29T00:39:43",
            "upload_time_iso_8601": "2023-11-29T00:39:43.279334Z",
            "url": "https://files.pythonhosted.org/packages/35/ff/6e35ec7850684b758e4468b817e95924f10689d7d6c61d72c127021e4e7e/getdominantcolor-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-29 00:39:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "getdominantcolor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "getdominantcolor"
}
        
Elapsed time: 0.20685s