Display images in R in version 3.1.0

I came across old stackoverflow messages such as this that use packages like ReadImages and biOps, which are now deprecated in R 3.1.0 and are no longer available.

Can someone tell me how to display an image in R 3.1.0? (In particular, jpeg and png images)

+3
source share
2 answers

As Simon Urbanek noted in the comments of a related question , you can do this:

library("jpeg")
jj <- readJPEG("myfile.jpg",native=TRUE)
plot(0:1,0:1,type="n",ann=FALSE,axes=FALSE)
rasterImage(jj,0,0,1,1)

or (for PNG)

library("png")
pp <- readPNG("myfile.png")
rasterImage(pp,0,0,1,1)

version 0.1.7 of png, 0.1.8 ofjpeg

+6
source

The package imagercan load png, jpeg and bmp images.

library(imager)
im<-load.image("myimage")
plot(im)

. , (ffmpeg ImageMagick), .

+5

All Articles