3

I'm looking for a gem to use with Rails 3 to extract some basic IPTC metadata from jpeg files (title, caption, ...). I have found ruby-iptc but I have no clue of how to use it having found no documentation or examples. Help anybody?

cih
  • 1,960
  • 1
  • 16
  • 27

2 Answers2

2

I use the gem mini_exiftool as a binding for the seperate commandline tool exiftool.exe It can read and change title and IPTC metadata.

require 'mini_exiftool'

# Reading meta data
photo = MiniExiftool.new 'heroes.jpg'
puts photo.title

# Writing meta data
photo = MiniExiftool.new 'heroes.jpg'
photo.title = 'This is the new title'
photo.rating = 20
photo.save
peter
  • 41,770
  • 5
  • 64
  • 108
0

This should do the trick, pretty well documented, not that active but it should suit your needs Exif reader.

cih
  • 1,960
  • 1
  • 16
  • 27
  • Thanks for the tip. It partly works - I can retrieve all EXIF and some additional meta-data e.g. caption (using the image_description method on the EXIF object you create), but not title. The EXIF object defines an 'iptc' method but this returns nil! Anyway, this will fit my purpose - I will add some internal structure to the caption part and parse it as I read it. – Christer Fernstrom Jan 03 '13 at 09:00