raster_to_array: Convert from a (small-r) raster object to an RGB array

View source: R/raster_array_conversions.R

raster_to_arrayR Documentation

Convert from a (small-r) raster object to an RGB array

Description

Recreates the original numeric array from a raster object created by grDevices::as.raster. Not to be confused with the ⁠Raster*⁠ classes used by the raster package.

Usage

raster_to_array(raster_obj, alpha = TRUE)

Arguments

raster_obj

A matrix of hex codes as output by grDevices::as.raster.

alpha

Logical. If there is an alpha channel, retain it in the array?

Value

A numeric RGB array (0-1 range).


recolorize documentation built on April 4, 2025, 3:07 a.m.