Expands an image or matrix canvas by adding constant-value padding around the original image.
render_padding(
image,
pad = 10,
color = "black",
alpha = NULL,
filename = NULL,
preview = FALSE
)3-layer RGB/4-layer RGBA array, rayimg class, matrix, or
filename of an image.
Default 10. Padding in pixels. Use a scalar for equal padding on
all sides, or c(top, right, bottom, left).
Default "black". Padding color. Can be a scalar, RGB/RGBA
numeric vector, or R color string.
Default NULL. Padding alpha for images with an alpha channel.
If NULL, uses the alpha channel supplied in color when present, otherwise
defaults to 0 when color is omitted and 1 when color is supplied.
Ignored for RGB and matrix inputs.
Default NULL. File to save the image to. If NULL and
preview = FALSE, returns the padded image.
Default FALSE. If TRUE, display the padded image.
A padded rayimg image or matrix.
render_padding(dragon, pad = 20) |>
plot_image()