From: Ollivier Robert Date: 2008-01-03T18:55:01+09:00 Subject: Re: RMagick Exif In article <3ed10879dcc030dbf9b38fb1b5575955@ruby-forum.com>, John Smith wrote: >I have been working to extract the exif information from jpegs using >RMagick and the get_exif_by_entry function. However, no matter what I >try it returns an empty array. I am certain the file has exif info as I >save it from Photoshop with the embed XMP option selected. The way I deal with these is by using exiftool with the mini_exiftool Ruby module. It has been working great so far. ----- require "rubygems" require "mini_exiftool" [...] def set_lens_info(data) lens_type = data.lens_type # # Check for M-42 lens # if lens_type.nil? or lens_type =~ /M-42|K,M/ then [...] data.lens_type = lens_type data.save end # -- set_lens_info [...] def main(argv) argv.each do |fn| data = MiniExiftool.new(fn) ts = data.date_time_original save_ok = set_lens_info(data) if save_ok then File.utime(Time.now, ts, fn) STDERR.puts("#{fn} saved ok, time changed") STDERR.puts(" #{data.lens}") else STDERR.puts("Error saving #{fn}") data.errors.each do |fld, msg| STDERR.puts(" #{fld}: #{msg}") end end end return 0 end # -- main -- Ollivier ROBERT -=- EEC/RIF/SEU -=- Systems Engineering Unit