palettes {pliman}R Documentation

Create image palettes

Description

image_palette() creates image palettes by applying the k-means algorithm to the RGB values.

Usage

image_palette(
  image,
  npal,
  filter = TRUE,
  blur = FALSE,
  parallel = FALSE,
  workers = NULL,
  verbose = TRUE
)

Arguments

image

An image object.

npal

The number of color palettes.

filter

Performs median filtering. This can be useful to reduce the noise in produced palettes. Defaults to TRUE. See more at image_filter().

blur

Performs blurring filter of palettes? Defaults to FALSE. See more at image_blur().

parallel

Processes the images asynchronously (in parallel) in separate R sessions running in the background on the same machine. It may speed up the processing time when image is a list. The number of sections is set up to 70% of available cores.

workers

A positive numeric scalar or a function specifying the maximum number of parallel processes that can be active at the same time.

verbose

If TRUE (default) a summary is shown in the console.

Value

Examples


library(pliman)
img <- image_pliman("sev_leaf_nb.jpg")
pal <- image_palette(img, npal = 4)
image_combine(pal)


# runs only in an iterative section
if(FALSE){
image_palette_pick(img)
}


[Package pliman version 1.1.0 Index]