Declare RGB channels
With RGB2col
you can convert a three-layer RGB SpatRaster into a single-layer SpatRaster with a color-table.
## S4 method for signature 'SpatRaster' RGB(x) ## S4 replacement method for signature 'SpatRaster' RGB(x)<-value ## S4 method for signature 'SpatRaster' RGB2col(x, value, stretch=NULL, grays=FALSE, filename="", overwrite=FALSE, ...)
x |
SpatRaster |
value |
vector of three positive integers indicating the layers that are red, green and blue. Or |
stretch |
character. Option to stretch the values to increase contrast: "lin" (linear) or "hist" (histogram) |
grays |
logical. If |
filename |
character. Output filename |
overwrite |
logical. If |
... |
additional arguments for writing files as in |
s <- rast(system.file("ex/logo.tif", package="terra")) RGB(s) <- c(1,2,3) plot(s) RGB(s) <- NULL
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.