I want to work with the magick
package for its fantastic image manipulations capabilities. Looking through here I can't seem to find out how to convert a 3D matrix (width x height x channels) to a magick
object I can further manipulate, and vice versa.
- There is no
as.magick
function - The
as.matrix
function does not work
But I would like something like:
height <- 100
width <- 80
X <- array(runif(height * width * 3, min = 0, max = 255), c(height, width, 3))
magick::as.magick(X) %>% magick::image_scale("500x400")
(Obviously I could write the matrix to disk as an image, then read it with magick::image_read
, that would be an overkill)
What did I miss?