Skip to main content

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


Download files

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

Source Distribution

color_palette_extractor-1.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

color_palette_extractor-1.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file color_palette_extractor-1.1.0.tar.gz.

File metadata

  • Download URL: color_palette_extractor-1.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for color_palette_extractor-1.1.0.tar.gz
Algorithm Hash digest
SHA256 eb263d29177fa218a98333530bd51bc0ae700061b7229ba2aa098ab38422f9ca
MD5 797523433b57b89e81f43364cdcfcdfb
BLAKE2b-256 8f3583dd78315df3d8e19f09d44620b27cf095aa5b5d8e9cdf5b405784dcb2b2

See more details on using hashes here.

File details

Details for the file color_palette_extractor-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for color_palette_extractor-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e62e1c9df078f82ad51429473b5d8f5693e9124c24066295b24889dc9fc37f0e
MD5 bacfdbe7775bfd4f0de23fea15ac09fe
BLAKE2b-256 832bb1c319ef6da75aea18a0f7a96e87d2801893d499ca4b3f453fa03e0791dd

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