10

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.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Max C
  • 2,573
  • 4
  • 23
  • 28

4 Answers4

6

The adimpro package may be useful. It maintains the EXIF data as a comment() on the imported image. (not used it myself though.)

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453
2

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"]]
1

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")

jgc
  • 71
  • 2
  • 3
0

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)
doubleh2
  • 95
  • 9