Skip to main content

A package that includes various tools, including a color extractor

Project description

stubbingmytoe

stubbingmytoe is a Python package that includes various tools, including a color extractor that processes images to extract the most common colors and generate visual representations.

Installation

To install the package, use pip:

pip3 install stubbingmytoe

Dependencies

The package requires the following dependencies:

  • opencv-python
  • numpy
  • scikit-learn
  • tqdm
  • matplotlib
  • jinja2

These dependencies will be installed automatically when you install the package.

Usage

Color Extractor

The color extractor processes images to extract the most common colors and generate visual representations of those colors. Here's how to use it:

Example Usage

from rubyapps.color_extractor.extractor import proccessImage

image_path = './dataset/starry_night.jpg'
proccessImage(image_path, 'starrynight', resolution=5, cycles=20, depth=1000, multiplier=5)

Parameters

  • image_path (str): Path to the image file.
  • name (str): Name of the project or image being processed.
  • resolution (int): Number of colors to extract in each clustering step (default is 5).
  • cycles (int): Number of secondary clustering cycles to perform (default is 10).
  • depth (int): Number of initial clustering iterations (default is 100).
  • multiplier (int): Multiplier for the number of colors to extract in the initial clustering step (default is 1).

Functions

  • most_common_colors(color_list, res): Returns the most common colors from a list.
  • preprocess_image(image_path): Preprocesses an image for color extraction.
  • proccess_pixels(hex_colors, res): Processes a list of hexadecimal color values.
  • extract_colors(pixels, num_colors=5): Extracts a specified number of colors from an image.
  • plot_colors(color_tuples, save_path=None): Plots the extracted colors.
  • apply_effect(colors, effect): Applies an effect to the extracted colors (e.g., 'vivid', 'pastels').
  • initial_cluster(image_path, effect='standard', suffix=None, name='default', res=5, multiplier=1): Performs the initial color clustering on an image.
  • secondary_cluster(hex, effect='standard', suffix=None, name='default', res=5): Performs secondary clustering on a list of colors.
  • cache(path, package): Caches intermediate results.
  • rgb_to_hex(rgb): Converts an RGB color to its hexadecimal representation.
  • render_html(image_path, final, output_path='output.html'): Renders the final color results to an HTML file.
  • proccessImage(image_path, name, resolution=5, cycles=10, depth=100, multiplier=1): Main function to process an image and extract colors.

Command Line Interface (CLI)

You can also use the color extractor from the command line. The proccessImage function is exposed as a CLI command.

color_extractor <image_path> <name> [resolution] [cycles] [depth] [multiplier]

Example:

color_extractor ./dataset/starry_night.jpg starrynight 5 20 1000 5

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Your Name (your.email@example.com)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rubyapps-0.1.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file rubyapps-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: rubyapps-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for rubyapps-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4e4d9c5f78d37665897cc466f191a8a61f32bbc5e0aaded6726d92a2b656e200
MD5 5cbe6a075aa96e330ac2ed1347a0f648
BLAKE2b-256 3ae5baa8a4896f850353f8595a3b4b2563217386914e7f823c9b87d97fa46a90

See more details on using hashes here.

Supported by

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