\name{make.RGB}

\alias{make.RGB}

\title{Create a RGB SpatRaster}

\description{
Make a Red-Green-Blue SpatRaster from a single layer
}


\usage{
make.RGB(x, col=grDevices::rainbow(25), breaks=NULL, alpha=FALSE, colNA="white", 
		zlim=NULL, zlimcol=NULL, ext=NULL, filename="", ...)
}

\value{SpatRaster}

\arguments{
  \item{x}{RasterLayer}
  \item{col}{A color palette, that is a vector of n contiguous colors generated by functions like \link{rainbow}, \link{heat.colors}, \link{topo.colors}, \link[sp]{bpy.colors} or one or your own making, perhaps using \code{\link{colorRampPalette}}. If none is provided, \code{rev(terrain.colors(255))} is used unless \code{x} has a 'color table'}
  \item{breaks}{numeric. A set of finite numeric breakpoints for the colours: must have one more breakpoint than colour and be in increasing order}  
  \item{alpha}{If \code{TRUE} a fourth layer to set the background transparency is added}
  \item{colNA}{color for the background (\code{NA} values)}
  \item{zlim}{vector of lenght 2. Range of values to plot}
  \item{zlimcol}{If \code{NULL} the values outside the range of zlim get the color of the extremes of the range. If zlimcol has any other value, the values outside the zlim range get the color of \code{NA} values (see colNA)}
  \item{ext}{SpatExtent. Can be used to spatially subset the area covered to a region of interest}
  \item{filename}{character. Output filename}
  \item{...}{options for writing files as in \code{\link{writeRaster}}}
}


\seealso{ \code{\link{RGB}}}

\examples{
r <- rast(system.file("ex/elev.tif", package="terra"))
x <- make.RGB(r)
plot(x)
}

\keyword{spatial}

