Resizes an image or a matrix, using bilinear interpolation.
render_resized(
image,
mag = 1,
dims = NULL,
filename = NULL,
preview = FALSE,
method = "tri"
)3-layer RGB/4-layer RGBA array, rayimg class, or filename of an image.
Default 1. Amount to magnify the image, preserving aspect ratio. Overridden if
dim is not NULL.
Default NULL. Exact resized dimensions.
Default NULL. The filename of the image to be saved. If this is not given, the image will be plotted instead.
Default FALSE. Whether to plot the convolved image, or just to return the values.
Default trilinear. Filters to up/downsample the image. Options: bilinear, box, trilinear,
catmull, mitchell.
A rayimg RGBA array.
if(run_documentation()){
#Plot the image with a title
dragon |>
render_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) |>
render_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) |>
render_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(160,320)) |>
render_title("Dragon (custom size)", title_offset=c(10,10), title_bar_color="black",
title_size=20, title_color = "white") |>
plot_image()
}