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?
Asked
Active
Viewed 3,449 times
1 Answers
1
install jpeg
library and load it and then call readJPEG
function with the .jpg file.
library('jpeg')
myjpeg_array <- jpeg::readJPEG(source = "myjpeg.jpg")

Sathish
- 12,453
- 3
- 41
- 59
-
Thank you! do you know how big the file would be before it could no longer be printed/ plotted in R? – Just_trying_to_get_by Jan 30 '17 at 10:33
-
Also, how would the file be plotted? I used the following, but it is not working. instead, it only shows me a picture of the R logo in the console when i run this code: myjpeg_array plot(0:1, 0:1, type = "n", ann =FALSE, axes = FALSE) rasterImage(img, 0, 0, 1, 1) @Sathish – Just_trying_to_get_by Jan 30 '17 at 10:35
-
Look at the help page of image: http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/image.html – Sathish Jan 30 '17 at 14:25