Modern Colorthief

Modern Colorthief

Extract dominant colors and color palettes from images at blazing speed.

~100x faster than pure Python colorthief

PyPI Version Python Versions License Crates.io Rust

Overview

Modern Colorthief is a high-performance Python library for extracting dominant colors and color palettes from images. Built with Rust and PyO3, it delivers near-C++ performance with the simplicity of a pure Python API.

Note

Powered by the Median Cut Color Quantization algorithm, compiled to a native extension via Maturin. Zero runtime dependencies beyond Python itself.

Quick Start

>>> from modern_colorthief import get_color, get_palette
>>>
>>> dominant = get_color("photo.jpg")
>>> print(dominant)
(139, 69, 19)
>>>
>>> palette = get_palette("photo.jpg", color_count=5)
>>> print(palette)
[(139, 69, 19), (220, 20, 60), (255, 250, 240), (34, 139, 34), (70, 130, 180)]

Why Modern Colorthief?

  • Blazing Fast – Rust-powered core delivers ~100x speedup over pure Python

  • Zero Dependencies – No Pillow, no NumPy required at runtime

  • Cross-Platform – Prebuilt wheels for Linux, macOS, Windows, and more

  • Simple API – Two functions, one CLI, that just work

  • Battle-Tested – Used in production by developers worldwide

Indices and Tables