• Stars
    star
    481
  • Rank 88,016 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 16 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

EXIF Reader

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

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

More Repositories

1

android-mode

Emacs minor mode for Android application development
Emacs Lisp
219
star
2

clj-android

Clojure development library for Android devices
Clojure
79
star
3

ring-basic-authentication

Moved to https://git.sr.ht/~rwv/ring-basic-authentication
Clojure
68
star
4

clojurehelloandroid

Hello World in Clojure for Android
Clojure
53
star
5

elein

running leiningen commands from emacs
Emacs Lisp
47
star
6

spotify-el

Basic emacs functions to control spotify client.
Emacs Lisp
23
star
7

active_form

ActiveRecord without persistance Plugin for Rails
Ruby
19
star
8

ring-partial-content

Moved to https://git.sr.ht/~rwv/ring-partial-content
Clojure
19
star
9

semira

Moved to sourcehut
Clojure
15
star
10

clj-base64

Functions to encode and decode base64 strings.
HTML
8
star
11

st-tty

A fast VT52 terminal emulator for a Atari ST with monochrome monitor.
Assembly
8
star
12

labelify

Labelled Form Builder Plugin for Rails
Ruby
7
star
13

alsamixer-el

Emacs interface to amixer
Emacs Lisp
5
star
14

markov

Mirror of https://git.sr.ht/~rwv/markov
Clojure
5
star
15

cljs-exif-reader

Extract information from TIFF and JPEG images.
Clojure
4
star
16

dutchify

Dutchify your Rails app Plugin
Ruby
3
star
17

unobtrusive_upload_progress

Unobtrusive Upload Progress for Rails with Mongrel
JavaScript
3
star
18

scheme-texinfo

Texinfo files about Scheme
Makefile
2
star
19

nos-tour-updates

Small mobile site for live NOS Tour de France comments.
Shell
2
star
20

risp

My adventure of writing something Lispy in Rust.
Rust
2
star
21

nullable_booleans

Nullable Booleans Plugin for Rails
Ruby
2
star
22

kilgore

A very basic event sourcing library.
Clojure
1
star
23

rtex-mode

Embedded Ruby Emacs Mode for Latex
Emacs Lisp
1
star
24

graphviz-dot-mode

Graphviz dot mode for emacs
Emacs Lisp
1
star