Learn R Programming

pavo (version 2.9.0)

img_conversion: Convert images between class rimg and cimg or magick-image

Description

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.

Usage

rimg2cimg(image)

rimg2magick(image)

Value

an image of the specified class

Arguments

image

an object of class rimg

Examples

Run this code
papilio <- getimg(system.file("testdata/images/butterflies/papilio.png", package = "pavo"))
# \donttest{
# Convert from class rimg to cimg
if (requireNamespace("imager", quiety = TRUE)) {
  papilio_cimg <- rimg2cimg(papilio)
  class(papilio_cimg)
}
# }

# Convert from class rimg to magick-image
papilio_magick <- rimg2magick(papilio)
class(papilio_magick)

Run the code above in your browser using DataLab