I need to manipulate some image files based on their EXIF data. Can something like this be done in R? I have not seen any R functions which could read EXIF data directly.
-
2`library(sos); findFn("exif")` – Ben Bolker May 26 '12 at 14:59
-
1I haven't tried, but it seems that since the question a way has appeared: https://www.r-bloggers.com/extracting-exif-data-from-photos-using-r/ – Pere May 13 '19 at 13:00
4 Answers
The adimpro package may be useful. It maintains the EXIF data as a comment()
on the imported image. (not used it myself though.)

- 170,508
- 25
- 396
- 453
I could not find an R package that did it natively either, so I implemented my own at https://github.com/cmartin/EXIFr
As of now, it only reads a subset of tags I was using for a project, but I could easily extend it to suit your needs.
For example, to read the aperture value :
read_exif_tags(image_path)[["ApertureValue"]]

- 131
- 4
It is probably faster and more versatile to use exiftool (http://www.sno.phy.queensu.ca/~phil/exiftool/)
system("/usr/local/bin/exiftool pathimagename.img")

- 71
- 2
- 3
I tried adimpro (too complicated for me- needs other packages etc) and EXIFr (got errors). exiftool worked, but I had to figure out a way to get the results of the system call into R. Heres how (you have to add , intern = TRUE):
1) install (http://www.sno.phy.queensu.ca/~phil/exiftool/) for your OS
2) use this in R: varName <- system("/usr/local/bin/exiftool path/example.jpg", intern = TRUE)

- 95
- 9