imagecolors - Extract colors from images
This module uses PIL (Pillow) to extract colors from images
Available functions
average(image, name=None, downsample=True, max_size=100, alpha_threshold=None)
Averages a single image into RGB color values. Returns a dictionary with the following keys: name, red, green, blue
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.
name - auto generated from image path by calling image.split(os.sep)[-1] unless set.
downsample - chooses if downsampling is enabled to speed up processing. Enabled by default.
max_size - max length of longest side if downsample is True
alpha_threshold - level at which transparent pixels are excluded from the average. Default is 245
average_images(dir_in)
Averages 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
dir_in - path to directory
directory_average(dir_in, name=None)
Averages all images in a directory to a singular RGB directory average. Returns a dictionary with the following keys: name, red, green, blue
dir_in - path to directory
name - auto generated from directory path by calling dir_in.split(os.sep)[-1] unless set.
nested_directory_average(root_dir)
Accepts 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
root_dir - path to starting directory
Future work
add usage examples to readme
add information for loadsave functions to readme
Tests
Testing is done with pytest
Run with python3 setup.py test
Metadata
Release files for imagecolor 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| imagecolor-1.2.1.tar.gz | 6.9 kB | Without provenance | Details for imagecolor-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| imagecolor-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for imagecolor-1.2.1-py3-none-any.whl |
Total release size: 17.2 kB
Release files / imagecolor-1.2.1.tar.gz
| Download URL | imagecolor-1.2.1.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4aa979089b91989fc99df75e8e790cfb48ab1d8760efd853f2b2bc0edaf0d391
|
|
BLAKE2b-256 checksum How to use checksums |
9a81144e6d37c341dafa7bc02fd185c7225f8476fc63f2953888c6dc00beba50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / imagecolor-1.2.1-py3-none-any.whl
| Download URL | imagecolor-1.2.1-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2555a8758d792dd66dfc35f6173734dd1913db79d5a80e6833da5aa11d285b16
|
|
BLAKE2b-256 checksum How to use checksums |
a0904c66e0b0c417e920706339f7e6737ac8793a18f9204b6a1f84a8d09d1a91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for imagecolor 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.