EXIF Reader
Find a file
Remco van 't Veer 7866ce4376
All checks were successful
ci/woodpecker/push/test/5 Pipeline was successful
ci/woodpecker/push/test/1 Pipeline was successful
ci/woodpecker/push/test/7 Pipeline was successful
ci/woodpecker/push/test/4 Pipeline was successful
ci/woodpecker/push/test/15 Pipeline was successful
ci/woodpecker/push/test/2 Pipeline was successful
ci/woodpecker/push/test/8 Pipeline was successful
ci/woodpecker/push/test/14 Pipeline was successful
ci/woodpecker/push/test/11 Pipeline was successful
ci/woodpecker/push/test/6 Pipeline was successful
ci/woodpecker/push/test/3 Pipeline was successful
ci/woodpecker/push/test/9 Pipeline was successful
ci/woodpecker/push/test/10 Pipeline was successful
ci/woodpecker/push/test/13 Pipeline was successful
ci/woodpecker/push/test/12 Pipeline was successful
Release 1.4.1
2025-01-10 17:04:21 +01:00
.woodpecker Move automatic testing to woodpecker 2025-01-07 18:09:44 +01:00
bin Fix executable bin/exifr 2017-07-07 22:22:47 +02:00
lib Adds possibility to skip thumbnails for JPEG 2023-05-24 14:26:05 +02:00
tests Adds possibility to skip thumbnails for JPEG 2023-05-24 14:26:05 +02:00
.gitignore Add Gemfile.lock to ignores 2018-04-29 16:29:58 +02:00
CHANGELOG Release 1.4.1 2025-01-10 17:04:21 +01:00
exifr.gemspec Release 1.4.1 2025-01-10 17:04:21 +01:00
Gemfile Get rid of some gem warnings 2020-09-09 22:03:20 +02:00
MIT-LICENSE Release 1.3.7 2020-09-11 08:36:05 +02:00
Rakefile Release 1.3.7 2020-09-11 08:36:05 +02:00
README.md Prepare release 1.4.0 2023-05-26 09:26:19 +02:00

EXIF Reader

Gem Version

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

Examples

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

require 'exifr/tiff'
EXIFR::TIFF.new('DSC_0218.TIF').width               # => 3008
EXIFR::TIFF.new('DSC_0218.TIF')[1].width            # => 160
EXIFR::TIFF.new('DSC_0218.TIF').model               # => "NIKON D1X"
EXIFR::TIFF.new('DSC_0218.TIF').date_time           # => Tue May 23 19:15:32 +0200 2006
EXIFR::TIFF.new('DSC_0218.TIF').exposure_time.to_s  # => "1/100"
EXIFR::TIFF.new('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 = SyslogLogger.new

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:

Time.local(..)

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| Time.zone.local(*args)}

XMP data access

If you need to access XMP data you can use the xmp gem. More info and examples at https://github.com/amberbit/xmp

Development and running tests

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

Author

R.W. van 't Veer

Copyright (c) 2006-2023 - R.W. van 't Veer