Description Usage Arguments Details See Also Examples
View source: R/paletteFunction.R
Image palette function
1 | image_palette(image, n, choice = mean, volume = FALSE)
|
image |
Matrix The image from which the palette will be extracted from. Should
be a 3 (or more) dimensional matrix. The output of a function such as |
n |
Integer The number of discrete colors to be extracted from the image. |
choice |
Function Defines how the color will be chosen from the final color cubes.
The default choice is to take the |
volume |
Logical volume controls the method for choosing which color cube to split
at each iteration of the algorithm. The default choice (when |
Uses the median cut algorithm to create n
discrete colors based on colors
present in an image. See median_cut
for more details.
1 2 3 | img <- jpeg::readJPEG(system.file("img", "Rlogo.jpg", package="jpeg"))
display_image(img)
scales::show_col(image_palette(img, n=5))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.