This function generates a colour palette based on the most prominent colors in an image..

img2pal(path, n, avgCols, exclude, n_clusters, customExclude = NULL)

Arguments

path

Character string. The path to the image file.

avgCols

Logical. Whether to average colours within clusters.

exclude

Character vector. List of colors in HEX format to exclude from the palette.

noCols

Integer. The number of most frequent colours in input image to consider.

nClust

Integer. The number of clusters for colour grouping.

Value

A colour palette generated from input image.

Examples

pal <- img2pal(path = "https://raw.githubusercontent.com/AlanInglis/colouR/master/images/bender.png",
               n = 10,
               avgCols = TRUE,
               exclude = TRUE,
               n_clusters = 15,
               customExclude = NULL)

pal
#>  [1] "#768C99" "#4E5455" "#667681" "#67767F" "#5A6268" "#3E484E" "#D9DFD2"
#>  [8] "#5B6E78" "#95A6B0" "#6E8492"