Conveniently convert single objects of class rimg to class cimg (from the package imager) or magick-image (from the package magick), both of which contains a suite of useful image-processing capabilities.

rimg2cimg(image)

rimg2magick(image)

Arguments

image

an object of class rimg

Value

an image of the specified class

Note

Attributes (e.g. scales, color-classes) will not be preserved following conversion from class rimg, so it's best to use early in the analysis workflow.

Examples

papilio <- getimg(system.file("testdata/images/papilio.png", package = "pavo")) # From class rimg to cimg papilio_cimg <- rimg2cimg(papilio) class(papilio_cimg)
#> [1] "cimg" "imager_array" "numeric"
# From class rimg to magick-image papilio_magick <- rimg2magick(papilio) class(papilio_magick)
#> [1] "magick-image"