0.33.0 • Published 6 years ago

major-colors v0.33.0

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

major-colors

Color segmentation using kmeans+++ for clustering and CIEDE2000 algorithm for color distance. Attempt to generate the optimal color palette given an image

Client-only!

This implementation relies on the canvas api to process the image

Install

npm i major-colors
yarn add major-colors

Usage

import MajorColors from 'major-colors'

const majorColors = new MajorColors(imageDomNode);
const { clusterResult, colors } =
  majorColors.getMajorColors({ numberOfColors: 5, quality: .10});

Outputs

colors [[number]]

an array of arrays which represent the colors in RGB vector

clusterResult - raw cluster ouput from k-means-plus

type result = {
  model: {
    observations: [[number]], // the original vectors: colors in Lab space
    centroids: [[number]], // vectors of final cluster centers: colors in Lab space
    assignments: [number] // mapping from index of original vector to the index of cluter center it belongs to
  },
  iterations: number, // number of iterations ran before converging
  durationMs: number // the duration of the algorithm
}
0.33.0

6 years ago

0.32.0

6 years ago

0.31.0

6 years ago

0.3.0

6 years ago

0.1.3

6 years ago

0.1.21

6 years ago

0.1.2

6 years ago

0.1.12

6 years ago

0.1.111

6 years ago

0.1.11

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago