Skip to content

labCentroids

labCentroids<S>(pixels, k, options?): LabCentroid<S>[]

Defined in: packages/math-color/src/models/lab-centroids.ts:29

Performs K-means clustering on the OKLab values of an image’s pixels to identify dominant colors.

S extends string

InSpace<LabCoords, S>[]

An array of OKLab pixel values to cluster.

number

The number of clusters (dominant colors) to identify.

KmeansOptions

Optional parameters for K-means clustering.

LabCentroid<S>[]

An array of WeightedCentroid objects representing the dominant colors and their weights.