Description Usage Arguments Details Examples
tweak: Quick image modification.
Recolor, add transparency, cut an image into two parts etc
1 |
img |
pth, url, array or raster of image to transform, supports tif jpg and png |
color |
the color to convert to, only R colors, original colors kept if NULL |
bold |
set all color values to chosen color, leaves alpha untouched (0 to 1) |
alpha |
to add more transparency (0 to 1) |
cuts |
vector of relative positions of cuts (0 to 1) |
dir |
direction of separation |
Originally designed to help build infographics in R.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | img <- system.file("img", "Rlogo.png", package="png")
imgs <- list(
tweak(img), # original
tweak(img,alpha=0.5), # transparent
tweak(img,"black"), # greyscales
tweak(img,"darkred"), # any R color
tweak(img,cuts=c(0.7),alpha = c(0,NA)), # clean cut
tweak(img,cuts=c(0.7),alpha = c(0.5,NA)), # transparency
tweak(img,cut=c(0.33,0.66), dir = "h",
color=c("black","gold","darkred")), # color on both side
tweak(img,"darkred",bold = 1), # make completely bold
tweak(img,"darkred",bold = 0.3) # make partially bold
)
showcase(imgs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.