img2pal {colouR}R Documentation

Create a Colour Palette from an Image

Description

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

Usage

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

Arguments

path

Character string. The path to the image file.

n

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

avgCols

Logical. Whether to average colours within clusters.

exclude

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

n_clusters

Integer. The number of clusters for colour grouping.

customExclude

Character vector. Optional vector of custom color codes in HEX format to be excluded.

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


[Package colouR version 0.1.1 Index]