Clone or download
Latest commit 9c17aa6 Nov 16, 2018


EXIF Reader

Gem Version Circle CI

EXIF Reader is a module to read metadata from JPEG and TIFF images.


require 'exifr/jpeg''IMG_6841.JPG').width               # => 2272'IMG_6841.JPG').height              # => 1704'IMG_6841.JPG').exif?               # => true'IMG_6841.JPG').model               # => "Canon PowerShot G3"'IMG_6841.JPG').date_time           # => Fri Feb 09 16:48:54 +0100 2007'IMG_6841.JPG').exposure_time.to_s  # => "1/15"'IMG_6841.JPG').f_number.to_f       # => 2.0'enkhuizen.jpg').gps.latitude       # => 52.7197888888889'enkhuizen.jpg').gps.longitude      # => 5.28397777777778

require 'exifr/tiff''DSC_0218.TIF').width               # => 3008'DSC_0218.TIF')[1].width            # => 160'DSC_0218.TIF').model               # => "NIKON D1X"'DSC_0218.TIF').date_time           # => Tue May 23 19:15:32 +0200 2006'DSC_0218.TIF').exposure_time.to_s  # => "1/100"'DSC_0218.TIF').f_number.to_f       # => 5.0

Logging warnings

When EXIF information is malformed, a warning is logged to STDERR with the standard Ruby logger. Log to some other location by supplying an alternative implementation:

EXIFR.logger =

Time zone support

EXIF does not support time zones so this code does not support time zones. All time stamps are created in the local time zone with:


It is possible to change this behavior by supplying an alternative implementation. For those who prefer UTC:

EXIFR::TIFF.mktime_proc = proc{|*args| Time.utc(*args)}

Or when the application depends on ActiveSupport for time zone handling:

EXIFR::TIFF.mktime_proc = proc{|*args|*args)}

XMP data access

If you need to access XMP data you can use the xmp gem. More info and examples at

Development and running tests

On a fresh checkout of the repository, run `bundle install` and then `bundle exec rake test`


R.W. van 't Veer


Copyright © 2006-2017 - R.W. van 't Veer