dominant-colours

Crates.iodominant-colours
lib.rsdominant-colours
version0.2.0
created_at2025-01-10 21:14:48.58335+00
updated_at2025-01-12 02:53:56.38737+00
descriptionExtract dominant colours from images using k-means clustering
homepage
repositoryhttps://github.com/llaisdy/dominant-colours
max_upload_size
id1511747
size42,202
Ivan Uemlianin (llaisdy)

documentation

README

dominant-colours

License: MIT

A command line tool that extracts dominant colours from images using k-means clustering. Unlike simpler color quantization algorithms, this tool uses machine learning to find natural color clusters and reports their prevalence in the image.

Features

  • Uses k-means clustering to find natural color groupings
  • Reports the percentage of the image occupied by each color
  • Generates SVG color swatches
  • Fast execution using optimized Rust libraries

Installation

cargo install --path .

Usage

# Basic usage - prints RGB values
dominant-colours image.jpg

# Specify number of colors to extract
dominant-colours -c 8 image.jpg

# Generate a color swatch
dominant-colours --swatch image.jpg

# Specify swatch output file
dominant-colours -s -o my-colors.svg image.jpg

Dependencies

  • image: Image loading and manipulation
  • linfa-clustering: Machine learning algorithms
  • clap: Command line argument parsing
Commit count: 5

cargo fmt