Skip to main content

Extract color palettes from images for web design. Produces LLM-consumable prose with color roles, WCAG contrast pairs, and harmonic relationships.

Project description

image-palette-extractor

Extract color palettes from images. Produces prose output suitable for LLM consumption, with optional HTML reports for human review.

How it works

Unlike simple color extraction that clusters pixels by RGB similarity, image-palette-extractor analyzes how colors relate to each other spatially:

  • Adjacency graph — Colors are understood through their neighbors, not in isolation. A yellow next to black has different significance than yellow next to orange.
  • LAB color space — All perceptual calculations use LAB, where distances match human perception. Colors 2.3 units apart are one "just noticeable difference."
  • Role assignment — Colors get roles (dominant, accent, light, dark) based on coverage, contrast, and spatial coherence — not just frequency.
  • Salience over coverage — A rare high-contrast accent can outrank a common background color in visual importance.

Installation

Requires Python 3.10+.

# With uv (recommended)
uvx image-palette-extractor -i image.png

# Or install globally
uv tool install image-palette-extractor
image-palette-extractor -i image.png

# Or with pip
pip install image-palette-extractor

Usage

image-palette-extractor -i <image_path> [options]

Options:

Flag Description
-i, --input Path to image file (required)
-o, --output Write HTML report. Optionally specify path, otherwise auto-names from input.
--no-downscale Process at full resolution instead of downscaling to 256px

Output

Text output includes:

  • Overview — Scheme classification (monochromatic, analogous, complementary, etc.), lightness/chroma ranges, distribution
  • Colors — Notable colors ranked by prominence with roles: Dominant, Secondary, Accent, Light, Dark
  • Relationships — WCAG-rated contrast pairs and harmonic color pairings

Each color shows hex, RGB, LAB values, coverage percentage, and perceptual notes.

Examples

# Analyze and print to terminal
image-palette-extractor -i photo.jpg

# Generate HTML report (auto-named photo-palette.html)
image-palette-extractor -i photo.jpg -o

# Generate HTML report with custom path
image-palette-extractor -i photo.jpg -o report.html

# Full resolution analysis (slower, more precise)
image-palette-extractor -i photo.jpg --no-downscale

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

image_palette_extractor-0.4.0.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

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

image_palette_extractor-0.4.0-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file image_palette_extractor-0.4.0.tar.gz.

File metadata

  • Download URL: image_palette_extractor-0.4.0.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for image_palette_extractor-0.4.0.tar.gz
Algorithm Hash digest
SHA256 109642fde2f2d8aa04b6462402cdfb64d85c3f9dc720752683747eacace649f1
MD5 3aa35be0ef4c509bfc834966e4b479b5
BLAKE2b-256 1ba4972a46e57efe4ffa340f2801e9ebb65fa7d833a1c911c226dc575b868dca

See more details on using hashes here.

Provenance

The following attestation bundles were made for image_palette_extractor-0.4.0.tar.gz:

Publisher: publish.yml on Capacap/palette-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file image_palette_extractor-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for image_palette_extractor-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9eeeb3acb91a6bacbcf2f1e245d1de837b6d8b662ea1656e626001b704be7384
MD5 a794b7ea1643d9cc51bb8539e52c01ee
BLAKE2b-256 90ee64ff30b487837e41d55285b2f6d89f06c533c9dd4796e25deed01a8aad7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for image_palette_extractor-0.4.0-py3-none-any.whl:

Publisher: publish.yml on Capacap/palette-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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