Skip to main content

A collection of tools for analyzing and sorting images by color.

Project description

ColorTools

A commandline tool for analyzing and sorting images by their dominant colors.

Installation

Installation is simple using pip:

$ pip install colortools

Usage

For details on how to use ColorTools, including many examples, see the included ColorTools Tutorial.

$ colortools --help
usage: colortools [-h] [--version] [--algorithm {hue_dist,kmeans}] [--n_colors N_COLORS]
                  [--n_colors_heuristic {auto_n_hue,auto_n_hue_binned,auto_n_binned_with_threshold,auto_n_simple_threshold}] [--skip_analysis_crop] [--exclude_bw]
                  [--exclude_color] [--sort {hue,saturation,value}] [--sort_reverse] [--sort_anchor SORT_ANCHOR] [--save_sorted] [--display] [--verbose]
                  [--output_dir OUTPUT_DIR] [--dominant_colors] [--dominant_colors_remapped] [--spectrum] [--spectrum_all_colors] [--collage] [--summary]
                  input

Analyze and sort images by their dominant colors.

positional arguments:
  input                 input directory of .jpg files (or a single .jpg file)

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --algorithm {hue_dist,kmeans}
                        algorithm to use for determining the dominant color of images (default kmeans)
  --n_colors N_COLORS, --n-colors N_COLORS
                        number of dominant colors to compute
  --n_colors_heuristic {auto_n_hue,auto_n_hue_binned,auto_n_binned_with_threshold,auto_n_simple_threshold}, --n-colors-heuristic {auto_n_hue,auto_n_hue_binned,auto_n_binned_with_threshold,auto_n_simple_threshold}
                        heuristic used to set `n` for the clustering algorithm
  --skip_analysis_crop, --skip-analysis-crop
                        Analyze images in their entirety, without any edge cropping.
  --exclude_bw, --exclude-bw
                        exclude black and white images from generated graphics
  --exclude_color, --exclude-color
                        exclude color images from generated graphics
  --sort {hue,saturation,value}
                        sort images
  --sort_reverse, --sort-reverse
                        reverse the image sort order
  --sort_anchor SORT_ANCHOR
                        anchor image with which to begin sorted sequence
  --save_sorted, --save-sorted
                        save sorted sequence of images
  --display             display generated graphics in addition to saving them
  --verbose             print a summary of the supplied arguments
  --output_dir OUTPUT_DIR, --output-dir OUTPUT_DIR
                        Output directory for sorted .jpg files.
  --dominant_colors, --dominant-colors
                        save dominant color visualization for each image
  --dominant_colors_remapped, --dominant-colors-remapped
                        include remapped image in dominant color visualization; ignored if not using kmeans algorithm
  --spectrum            save spectrum image for the current collection of images
  --spectrum_all_colors, --spectrum-all-colors
                        include all detected dominant colors in the spectrum graphic
  --collage             save a collage of the analyzed images
  --summary             print a summary of the analyzed images to the console

Building from Source

To build from source:

$ python -m build

Then, to install the local build file using pip:

$ pip install dist/npt_colortools-VERSION-none-any.whl

Tests and Coverage

To run tests with coverage, generate an HTML report, and open the report:

$ coverage run -m pytest tests && coverage html && open htmlcov/index.html 

Known Issues

  • First run after installation is slow.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbp-colortools-1.0.1.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

nbp_colortools-1.0.1-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file nbp-colortools-1.0.1.tar.gz.

File metadata

  • Download URL: nbp-colortools-1.0.1.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for nbp-colortools-1.0.1.tar.gz
Algorithm Hash digest
SHA256 79c0cfac590ea6e86b85d18002b32c186d37e29f02ab7497a3740efc7367bc0e
MD5 a39f434de7d1461408d06db0613a6d56
BLAKE2b-256 1598e26739ac7338afc499b3d6df7bf256cd9033df9d558c649d966a6a3c5f1c

See more details on using hashes here.

File details

Details for the file nbp_colortools-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nbp_colortools-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe9865ab2011af78969854ddae525b1374aa0568558f7641f876b73325acc476
MD5 afdc5fb924ab9dbc2a4b65debba9a2d5
BLAKE2b-256 fb5fd4ef7a9270e024f823a4fa8b75b169b7400d2401429efa28bd20694f802d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page