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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file image_palette_extractor-0.3.0.tar.gz.
File metadata
- Download URL: image_palette_extractor-0.3.0.tar.gz
- Upload date:
- Size: 34.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b8a00a910f612eeb9fc25347de7480daaaf8fded15b7b5a8a189d01ec685f65
|
|
| MD5 |
a2ac5198b36bebb9ca66bf575872f871
|
|
| BLAKE2b-256 |
1f4b2ed5c0c572ac0cf12539774b4deb4e42f8ace4eb592fcc462b3ddc5d0f9e
|
Provenance
The following attestation bundles were made for image_palette_extractor-0.3.0.tar.gz:
Publisher:
publish.yml on Capacap/palette-extractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
image_palette_extractor-0.3.0.tar.gz -
Subject digest:
2b8a00a910f612eeb9fc25347de7480daaaf8fded15b7b5a8a189d01ec685f65 - Sigstore transparency entry: 787236005
- Sigstore integration time:
-
Permalink:
Capacap/palette-extractor@88d2acfca23146311b73ee38c419a232c0d6a36a -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/Capacap
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@88d2acfca23146311b73ee38c419a232c0d6a36a -
Trigger Event:
release
-
Statement type:
File details
Details for the file image_palette_extractor-0.3.0-py3-none-any.whl.
File metadata
- Download URL: image_palette_extractor-0.3.0-py3-none-any.whl
- Upload date:
- Size: 34.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34e1c0cc1840f29aadbd552bff08c07b35122451940d33faf1a3a1c1f932f0a4
|
|
| MD5 |
eba35eb47aa7c5db61e6cb231cafcd3c
|
|
| BLAKE2b-256 |
d1218fdb853e81aee4d679e257269c9d885b97e02e51eef6f031438ae3e15fa5
|
Provenance
The following attestation bundles were made for image_palette_extractor-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on Capacap/palette-extractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
image_palette_extractor-0.3.0-py3-none-any.whl -
Subject digest:
34e1c0cc1840f29aadbd552bff08c07b35122451940d33faf1a3a1c1f932f0a4 - Sigstore transparency entry: 787236007
- Sigstore integration time:
-
Permalink:
Capacap/palette-extractor@88d2acfca23146311b73ee38c419a232c0d6a36a -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/Capacap
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@88d2acfca23146311b73ee38c419a232c0d6a36a -
Trigger Event:
release
-
Statement type: