Convert nativeRaster
images to/from other R objects
nr_to_raster(nr)
raster_to_nr(ras, dst = NULL)
nr_to_array(nr)
array_to_nr(arr, dst = NULL)
nativeRaster
object
standard R raster i.e. a character matrix of hex color values
destination nativeRaster
If NULL (the default) a new nativeRaster
will be created.
3d numeric array representing R,G,B,A values with dimensions [nrow, ncol, 4] or [nrow, ncol, 3]. Each value is in range [0,1].
raster, array or nativeRaster
nr <- nr_new(12, 8, 'hotpink')
nr_to_raster(nr)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [2,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [3,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [4,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [5,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [6,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [7,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [8,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [,7] [,8] [,9] [,10] [,11] [,12]
#> [1,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [2,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [3,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [4,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [5,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [6,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [7,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"
#> [8,] "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF" "#FF69B4FF"