View source: R/render_resized.R
render_resized | R Documentation |
Resizes an image or a matrix, using bilinear interpolation.
render_resized(
image,
mag = 1,
dims = NULL,
filename = NULL,
preview = FALSE,
method = "tri"
)
image |
Image filename, 3-layer RGB array, or matrix. |
mag |
Default |
dims |
Default |
filename |
Default |
preview |
Default |
method |
Default |
3-layer RGB resized array or matrix.
if(run_documentation()){
#Plot the image with a title
dragon |>
add_title("Dragon", title_offset=c(10,10), title_bar_color="black",
title_size=20, title_color = "white") |>
plot_image()
}
if(run_documentation()){
#Half of the resolution
render_resized(dragon, mag = 1/2) |>
add_title("Dragon (half res)", title_offset=c(5,5), title_bar_color="black",
title_size=10, title_color = "white") |>
plot_image()
}
if(run_documentation()){
#Double the resolution
render_resized(dragon, mag = 2) |>
add_title("Dragon (2x res)", title_offset=c(20,20), title_bar_color="black",
title_size=40, title_color = "white") |>
plot_image()
}
if(run_documentation()){
#Specify the exact resulting dimensions
render_resized(dragon, dim = c(320,160)) |>
add_title("Dragon (custom size)", title_offset=c(10,10), title_bar_color="black",
title_size=20, title_color = "white") |>
plot_image()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.