Hi, I have made a few corrections to my previous message in the naming of my objects.
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(nuc_MAG_o) nuc_MAG_to_IMG <- magick2cimg(nuc_MAG_o,alpha="flatten") # convert from EBImage library(EBImage) nuc_EB_o <- readImage(system.file("images", "nuclei.tif", package="EBImage")) writeImage(nucEBo, "C:/Rfiles/nuclei-3.jpg") # to convert nuc_EB_o nucEB_to_IMG <- nucEB_to_MAG <- #convert from imager library(imager) nuc_IMG_o <- load.image("C:/Rfiles/nuclei-3.jpg") # to convert nuc_IMG_o nuc_IMG_to_EB <- nuc_IMG_to_MAG <- Thanks, Vivek Den ons 24 mars 2021 kl 18:54 skrev Vivek Sutradhara <viveksu...@gmail.com>: > 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]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.