Skip to main content

version github python35 license format

This module uses imagecolor with PIL(Pillow) to extract colors from web image searches.

Available functions

average_image_url(url, name)

Averages a single image from a url into RGB color values. Returns a dictionary with the following keys: name, red, green, blue

  • url - image url.

  • name - name to return. Generally passed from the function that generates the url.

  • timeout - requests timeout in seconds.

  • max_size - maximum size of image to fetch in MB.

_image_search_average(url_list, max_threads=20)

Averages all urls in a list into a singular RGB average.

  • url_list - path to directory

  • max_threads - max processes to spawn.

  • timeout - requests timeout in seconds. This gets passed to average_image_url

  • max_size - maximum size of image to fetch in MB. This gets passed to average_image_url

google_average(search_term, num_results, api_key, cse_id, max_threads=20)

Does a Google image search and averages all the images into a singular RGB search average. Returns a dictionary with the following keys: name, red, green, blue

  • search_term - Google image search term.

  • num_results - Number of results to include.

  • api_key - Google API key.

  • cse_id - Google CSE ID.

  • max_threads - max processes to spawn. This gets passed to \_image_search_average

  • timeout - requests timeout in seconds. This gets passed to average_image_url

  • max_size - maximum size of image to fetch in MB. This gets passed to average_image_url

Future work

  • add more information to readme

  • build offline tests

Tests

Testing is done with pytest

Currently tests only the google api. Requires the enviroment variables GOOGLE_SEARCH_API and GOOGLE_SEARCH_CSE to be set to a valid google custom search api and id

Run with python3 setup.py test

Metadata

Release files for searchcolor 2.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for searchcolor 2.1.3
File Size Uploaded
searchcolor-2.1.3.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for searchcolor 2.1.3
File Interpreter ABI Platform
searchcolor-2.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / searchcolor-2.1.3.tar.gz

Download URL searchcolor-2.1.3.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2f896b24bcaa307df84e0d37b6b693007fef316b3ac8bffc9eea1f0f11aebb22
BLAKE2b-256 checksum
How to use checksums
db6b3793258a36ddbd6a396af169d60dc7ec6c4eef4729ad5f17811fa8a17003
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / searchcolor-2.1.3-py3-none-any.whl

Download URL searchcolor-2.1.3-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
851fddc7639d364b2f4276d121ebbe918947fd639469ba5d8d2d0341f6863de6
BLAKE2b-256 checksum
How to use checksums
f055b7c78cf0a45ea3e8ae7d118538c898984e4e15822819b15858abff2d6d17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

2.1.3 This release

2 release files

2.0.0

2 release files

1.4.1

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page