An open API service indexing awesome lists of open source software.

https://github.com/bradsec/gokmeans

Go K-Means Image Color Separation Dominant Color Finder written in Go
https://github.com/bradsec/gokmeans

go golang image-colors image-processing kmeans kmeans-algorithm kmeans-clustering

Last synced: 2 months ago
JSON representation

Go K-Means Image Color Separation Dominant Color Finder written in Go

Awesome Lists containing this project

README

        

# Go K-Means Image Color Separation/Dominant Color Finder written in Go

This is a command-line program written in Go which performs color quantization on images and identifies the dominant colors in them.

## Features

- Color quantization using K-means clustering
- Identification of dominant colors in images
- Output is provided in JSON and HTML formats
- Supports JPEG and PNG image formats
- Using Go standard library only

## Usage

To use the program, you need to provide the input file or directory as a command-line argument. You can also specify the number of prominent colors to find and the color value format (hex or rgb) using flags:

```terminal
go run main.go

# Or run as binary after 'go build'

gokmeans
```

```terminal
# Use -n to set number of dominant colors to find (based on higher percentage)
go run main.go -n 10
```

### Sample Images

Sample HTML output: https://bradsec.github.io/gokmeans/

multicolor.png

Original image
Quantized image

gopherblue.png

Original image
Quantized image