RMagick Exif

Hi all:

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.

A simply test such as:

photo = Magick::Image.read(path_to_file).first

photo.get_exif_by_entry

returns [] always

Am I missing something?

I have RMagick 2.0 installed.

Thanks,

John

Subject: RMagick Exif
Date: Wed 02 Jan 08 04:40:33PM +0900

Quoting John S. ([email protected]):

returns [] always

Here I receive a populated hash. You say you are sure that the tags
are present, but did you check this with a standalone tool
(e.g. exiftags here on linux)?

Carlo

Carlo E. Prelz wrote:

Subject: RMagick Exif
Date: Wed 02 Jan 08 04:40:33PM +0900

Quoting John S. ([email protected]):

returns [] always

Here I receive a populated hash. You say you are sure that the tags
are present, but did you check this with a standalone tool
(e.g. exiftags here on linux)?

Carlo

Yes, I have made sure that the exif information is there by loading the
file into Lightroom and it is able to list all the exif data.

Tim H. wrote:

John S. wrote:

John
Open a bug track on RubyForge and upload the image you’re trying to use.
Also add which version of ImageMagick you’re using.

ImageMagick version 6.3.5.

John S. wrote:

John
Open a bug track on RubyForge and upload the image you’re trying to use.
Also add which version of ImageMagick you’re using.

In article [email protected],
John S. [email protected] 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

Subject: Re: RMagick Exif
Date: gio 03 gen 08 04:30:44 +0900

Quoting John S. ([email protected]):

Yes, I have made sure that the exif information is there by loading the
file into Lightroom and it is able to list all the exif data.

The best thing you can do is open a ticket on rubyforge, attaching a
copy of the image, as the author of rmagick suggested. First register
at

http://rubyforge.org/account/register.php

and then login and submit your ticket at

http://rubyforge.org/tracker/?func=add&group_id=12&atid=133

Carlo