imagecolor - Extract colors from images

python pypi commit Build Status Documentation Status license

imagecolor is a python module for averaging images using pillow. When processing of multiple images it uses concurrent.futures for multiprocessing.

Important notes

Warnings

Warning

imagecolor only supports python3.6 currently.

Notes

Note

imagecolor is only tested on macOS and Linux currently.

Note

imagecolor only works on 3 channel RGB images.

Installation

Basic Installation

Install imagecolor with pip:

$ pip install imagecolor

Depending on your platform you might need to install the required dependencies for pillow before pillow (and imagecolor) will install fully.

Usage examples

To use imagecolor import it with

import imagecolor

average an image

Average a single image file to a dict containing name, red, green, & blue

imagecolor.file_average(image)

If you are not interested in the file name you can use core_average() instead.

imagecolor.core_average(image)

average all images in a directory

Averages all images in a directory to a list of dicts containing name, red, green, & blue

imagecolor.directory_average(directory)

average a directory

Averages all images in a directory to a dict containing name, red, green, & blue

imagecolor.single_directory_average(directory)

average nested directories

Uses single_directory_average to average the directory and all subdirectories containing images to a list of dicts containing name, red, green, & blue

imagecolor.nested_directory_average(directory)

For more details read the full module reference

Development

Development Installation

image color uses pipenv to manage development dependencies.

Install development dependencies with pipenv:

$ pipenv install --dev

make commands

  • all: calls release and html
  • release checks the code with test and then calls source-dist and wheel-dist
  • source-dist builds a source distribution
  • wheel-dist builds a wheel distribution
  • lint lints imagecolor with pylint, pycodestyle, pydocstyle
  • test lints the code and then runs pytest
  • html builds html docs with Sphinx
  • clean cleans the build and dist directories

License

The MIT License

Copyright 2017-2018 Rhys Hansen (Tathorack)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.