The Rexif Package

Rexif_0.1-0.tar.gz

Digital cameras add meta-data to the images that provide information about the camera model, settings when the picture was taken and important information such as the time and date. This information is stored using the Exchange Image File Format - EXIF. This package provides tools in R to read this information along with facilities for determining the dimensions of JPEG images. (This is also available implicitly from the rimage package.)

The meta-data can be used for many different purposes. It is interesting to analyze the data to see the effects of the different settings on the quality of the image. It is also easy to look at large collections of images (e.g. www.flickr.com) to explore the different cameras. For my purposes, I wanted a convenient way to remove duplicates and thumbnail images that had made their way into my iPhoto library. R's convenient vectorized data manipulation and graphics facilities made this simple once the data were in R.

The package is intentionally small. However, it provides two different approaches to reading the EXIF information from a file. One uses libexif, a C library that can read this meta-data, and the other uses Python code from Gene Cash via the RSPython package. Interestingly, the Python code is remarkably fast, appearing to be about 4 times as fast as the C-level interface in the package.

I have encountered the Python code failing on a few images. Additionally, the two approaches give different results and not just in the names they use when reporting the EXIF entries.

Note

This code uses new features in the useDynLib() directive of the NAMESPACE file to access native routines. To use this package you will need a version of R more recent than R-2.2.0. At present, that means the development version.

Documentation and Examples

  • Example
  • This reads the EXIF data from the images included in the package and creates a data frame with the camera model, date and time, width, height and file name. The example uses the Python code to read the EXIF data, however, it is easy to substitute the getExifPy() function with getExif() and the script should work identically.
  • Function documentation from the package
  • PDF and HTML pages

    Duncan Temple Lang <duncan@wald.ucdavis.edu>
    Last modified: Wed Dec 7 09:50:34 PST 2005