Closed ShotaOchi closed 5 years ago
Thanks Shota, I agree with the suggestion. I think there ought to be a better way of doing the conversion than writing to disk, though. I don't know magick at all but there has to be a function for constructing a magick object from RGB data in memory, right?
You're right. A better example is shown below.
cimg2magick <- function(im)
{
image_read(as.raster(im))
}
That's much better, but there's still an inefficiency and a possible loss of information if you have "raster" as an intermediate format (it converts to an array of RGB values represented as a character string). There has to be a more direct way. Happy to accept this in a pull request if you make one.
I suggest adding new function that is a reverse of 'magick2cimg' function.
magick package has functions that are not implemented in imager. I use the functions. I think it would be convenient if we can convert imager object into magick object easily.
An example of the new function is shown below.
What do you think?