Description Usage Arguments Value Examples
Swap the palette of an image!
1 2 | switch_colors(target_image, source_image, source_colors = 3,
smoothness = 100, ...)
|
target_image |
Matrix The image you wish to transfer colors into.
The output from |
source_image |
Matrix The image you wish to transfer colors from. |
source_colors |
Integer The number of colors you wish to extract from the source image. |
smoothness |
Integer The source colors are interpolated such that the image doesn't appear blocky. The value of smoothness determines how many values are interpoloated between the source_colors. That is, smoothness determines the length of the palette used. Higher values return smoother images. |
... |
Pass any of the arguments for |
The image, but with swapped colors!
1 2 3 4 5 | #Trivial example of using only 5 dominant colors
# from an image to recolor itself
img1 <- jpeg::readJPEG(system.file("img", "Rlogo.jpg", package="jpeg"))
img2 <- jpeg::readJPEG(system.file("img", "Rlogo.jpg", package="jpeg"))
switch_colors(img1, img2, source_colors=5, smoothness=20)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.