% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/render_padding.R
\name{render_padding}
\alias{render_padding}
\title{Add Transparent Padding}
\usage{
render_padding(
  image,
  pad = 10,
  color = "black",
  alpha = NULL,
  filename = NULL,
  preview = FALSE
)
}
\arguments{
\item{image}{3-layer RGB/4-layer RGBA array, \code{rayimg} class, matrix, or
filename of an image.}

\item{pad}{Default \code{10}. Padding in pixels. Use a scalar for equal padding on
all sides, or \code{c(top, right, bottom, left)}.}

\item{color}{Default \code{"black"}. Padding color. Can be a scalar, RGB/RGBA
numeric vector, or R color string.}

\item{alpha}{Default \code{NULL}. Padding alpha for images with an alpha channel.
If \code{NULL}, uses the alpha channel supplied in \code{color} when present, otherwise
defaults to \code{0} when \code{color} is omitted and \code{1} when \code{color} is supplied.
Ignored for RGB and matrix inputs.}

\item{filename}{Default \code{NULL}. File to save the image to. If \code{NULL} and
\code{preview = FALSE}, returns the padded image.}

\item{preview}{Default \code{FALSE}. If \code{TRUE}, display the padded image.}
}
\value{
A padded \code{rayimg} image or matrix.
}
\description{
Expands an image or matrix canvas by adding constant-value
padding around the original image.
}
\examples{
\dontshow{if (interactive() || identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf}
render_padding(dragon, pad = 20) |>
 plot_image()
\dontshow{\}) # examplesIf}
}
