[R] converting image formats

Vivek Sutradhara v|vek@utr@ @end|ng |rom gm@||@com
Wed Mar 24 18:54:37 CET 2021


Hi,
I would like to have help in converting from one image format to another
(between the packages EBImage, magick and imager). The magick package has
functions for this. But the EBImage and imager packages do not have
in-built functions for the conversion. It is, of course, possible to save
the images and then open with the other packages. But I am looking for more
direct options. I do not know how to assign data to the "slots" in the
functions.

### convert image formats
library(magick)
nuc_MAG_o <- image_read(system.file("images", "nuclei.tif",
package="EBImage"))
nuc_MAG_to_EB <- as_EBImage(manMAG)
nuc_MAG_to_IMG <- magick2cimg(manMAG,alpha="flatten")

# convert from EBImage
library(EBImage)
nucEBo <-  readImage(system.file("images", "nuclei.tif", package="EBImage"))
writeImage(nucEBo, "C:/Rfiles/nuclei-3.jpg")
nucEB_to_IMG <-
nucEB_to_MAG <-

#convert from imager
library(imager)
nuc_IMG_o <- load.image("C:/Rfiles/nuclei-3.jpg")
nuc_IMG_to_EB <-
nuc_IMG_to_MAG <-

All help is appreciated.
Thanks,
Vivek

	[[alternative HTML version deleted]]



More information about the R-help mailing list