Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby gem for extracting IPTC data from JPEG

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?

like image 532
Christer Fernstrom Avatar asked Jul 10 '26 07:07

Christer Fernstrom


1 Answers

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
like image 134
peter Avatar answered Jul 13 '26 10:07

peter