{"id":23843410,"url":"https://github.com/tathorack/imagecolor","last_synced_at":"2026-06-15T01:32:38.250Z","repository":{"id":62570510,"uuid":"81384098","full_name":"Tathorack/imagecolor","owner":"Tathorack","description":"Python image color extraction","archived":false,"fork":false,"pushed_at":"2023-11-20T20:51:26.000Z","size":129,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-20T21:52:22.271Z","etag":null,"topics":["python","python-package","python3"],"latest_commit_sha":null,"homepage":"","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/Tathorack.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-02-08T22:47:26.000Z","updated_at":"2022-02-02T23:34:56.000Z","dependencies_parsed_at":"2023-11-20T20:28:18.823Z","dependency_job_id":"995defbf-30b7-4381-bf15-4da24ba45575","html_url":"https://github.com/Tathorack/imagecolor","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tathorack%2Fimagecolor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tathorack%2Fimagecolor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tathorack%2Fimagecolor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tathorack%2Fimagecolor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tathorack","download_url":"https://codeload.github.com/Tathorack/imagecolor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240131760,"owners_count":19752727,"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":["python","python-package","python3"],"created_at":"2025-01-02T19:28:33.640Z","updated_at":"2026-05-21T17:30:20.612Z","avatar_url":"https://github.com/Tathorack.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"========================================\nimagecolors - Extract colors from images\n========================================\n\n|version| |github| |python35| |license| |format|\n\n.. |version| image:: https://img.shields.io/pypi/v/imagecolor.svg\n    :target: https://pypi.python.org/pypi/imagecolor\n.. |python35| image:: https://img.shields.io/badge/Python-3.5-brightgreen.svg\n    :target: https://www.python.org/\n.. |license| image:: https://img.shields.io/badge/License-MIT-blue.svg\n    :target: https://github.com/Tathorack/imagecolor/blob/master/LICENSE.md\n.. |github| image:: https://img.shields.io/github/tag/Tathorack/imagecolor.svg\n   :target: https://github.com/Tathorack/imagecolor\n.. |format| image:: https://img.shields.io/pypi/format/imagecolor.svg\n    :target: https://pypi.python.org/pypi/imagecolor\n\n------------------------------------------------------------\nThis module uses PIL (Pillow) to extract colors from images\n------------------------------------------------------------\n\nAvailable functions\n===================\naverage(image, name=None, downsample=True, max_size=100, alpha_threshold=None)\n==============================================================================\nAverages a single image into RGB color values. Returns a dictionary with the following keys: ``name``, ``red``, ``green``, ``blue``\n\n* ``image`` - filename (string), pathlib.Path object or a file object. The file object must implement ``read()``, ``seek()``, and ``tell()`` methods, and be opened in binary mode.\n* ``name`` -  auto generated from image path by calling ``image.split(os.sep)[-1]`` unless set.\n* ``downsample`` - chooses if downsampling is enabled to speed up processing. Enabled by default.\n* ``max_size`` - max length of longest side if ``downsample`` is True\n* ``alpha_threshold`` - level at which transparent pixels are excluded from the average. Default is 245\n\naverage_images(dir_in)\n======================\nAverages each individual image in a directory and returns a list with an entry for each image successfully averaged. Returns a list containing a dictionary for each image with the following keys: ``name``, ``red``, ``green``, ``blue``\n\n* ``dir_in`` - path to directory\n\ndirectory_average(dir_in, name=None)\n====================================\nAverages all images in a directory to a singular RGB directory average. Returns a dictionary with the following keys: ``name``, ``red``, ``green``, ``blue``\n\n* ``dir_in`` - path to directory\n* ``name`` - auto generated from directory path by calling ``dir_in.split(os.sep)[-1]`` unless set.\n\nnested_directory_average(root_dir)\n==================================\nAccepts the path to a directory and walks all the enclosed directories calling ``average_directory`` for each one that contains images. Returns a list containing a dictionary for each directory with the following keys: ``name``, ``red``, ``green``, ``blue``\n\n* ``root_dir`` - path to starting directory\n\nFuture work\n===========\n* add usage examples to readme\n* add information for loadsave functions to readme\n\nTests\n=====\nTesting is done with pytest_\n\n.. _pytest: http://docs.pytest.org/en/latest/\n\nRun with ``python3 setup.py test``\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftathorack%2Fimagecolor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftathorack%2Fimagecolor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftathorack%2Fimagecolor/lists"}