简体   繁体   中英

Opening .jpg files in R: can you only open JPEG files if the file lies in an R packages?

I noticed that if you are trying to use "system.file()" to source the image for "readJPEG()", then you have to include a package name in order to open the image. But what if I wanted to open a .jpg file from say, my pictures folder? Is this possible? Is R only able to open images using system.file() to source .jpg files?

install jpeg library and load it and then call readJPEG function with the .jpg file.

library('jpeg')
myjpeg_array <- jpeg::readJPEG(source = "myjpeg.jpg")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM