Extract dominant colors, generate PNG palettes, JSON exports, and name colors using custom palettes.
Project description
🎨 Color Palette Extractor
A modern Python package for extracting dominant colors from images, generating PNG palette previews, exporting color data to JSON, and naming colors using any custom palette (e.g., Pantone, Material, Brand palettes).
This package includes:
- Dominant color extraction using K-Means
- RGB or HEX output
- PNG color palette image generation
- JSON export
- Optional color naming using custom palettes (Pantone-compatible if you provide the licensed palette)
- Command-line interface (
colorpalette) - Clean import API for integration in other scripts
Installation
Run:
pip install .
CLI Usage
colorpalette input.jpg --colors 5 --format hex --json palette.json --png palette.png
Color Naming
Provide a custom palette JSON:
colorpalette input.jpg --name-colors --palette pantone.json
Python Usage
from color_palette_extractor import extract_palette
colors, names = extract_palette("image.jpg", num_colors=5, output_format="hex")
Package Structure
color_palette_extractor/
- extractor.py
- palette_image.py
- utils.py
- color_naming.py
- cli.py
- init.py
License
MIT License
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 color_palette_extractor-1.2.0.tar.gz.
File metadata
- Download URL: color_palette_extractor-1.2.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13d448b8de4575e5e328f540f52d980e867d960b6c12f0de6bf0b45e84042ca5
|
|
| MD5 |
05045a2b4a38e44760e3e0fabd776857
|
|
| BLAKE2b-256 |
7b4e6c90db7499cfb5a25f89d67b31e24401d4ace2d7f4a01a50495d6e82e79b
|
File details
Details for the file color_palette_extractor-1.2.0-py3-none-any.whl.
File metadata
- Download URL: color_palette_extractor-1.2.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e12791be83083b713eb53319f83378535b4e2bcc68c36b3b9f576f0ad60e456c
|
|
| MD5 |
eebc3caf5533735eb41af40353bd6784
|
|
| BLAKE2b-256 |
a0baebc523905fef1afeade816f9f3827d9f6823509ae14d8ace497c40627438
|