Question

I'm attempting to get image EXIF data from the ruby-vips gem but I keep receiving errors. I've found documentation from others who have attempted to repair this issue and I've attempted their fixes with no success.

i=VIPS::Image.new("/home/eric/Pictures/golden-clouds-wallpaper.jpg")
i.get("exif-Orientation")
i.get("exif-ifd0-Orientation")

Both give errors:

VIPS error: vips_image_get: field "exif-Orientation" not found
VIPS error: vips_image_get: field "exif-ifd0-Orientation" not found

Ubuntu version 13.10

Vips version 7.28.5

ruby-vips 0.3.7

Edit

2.1.0 :001 > require 'rubygems' => false 
2.1.0 :002 > require 'vips' => true 
2.1.0 :003 > a = VIPS::Image.new('/home/eric/Pictures/devProfile.JPG') => #<VIPS::Image:0x00000001e4d7b0> 
2.1.0 :004 > a.get("exif-Orientation")
VIPS::Error: VIPS error: vips_image_get: field "exif-Orientation" not found

from (irb):4:in `get'
from (irb):4
from /home/eric/.rvm/rubies/ruby-2.1.0/bin/irb:11:in `<main>'
Was it helpful?

Solution

Install the vips GUI, nip2, then try loading your JPEG image in that. Right-click on the thumbnail, select Header, and look at the fields displayed. You should see orientation in there.

I have Ubuntu 13.10 / vips-7.28.5 / ruby-vips 0.3.7 here and I see:

$ vips --version
vips-7.28.5-Sat Mar  9 18:46:42 UTC 2013
$ gem install ruby-vips
Fetching: ruby-vips-0.3.7.gem (100%)
Building native extensions.  This could take a while...
Successfully installed ruby-vips-0.3.7
1 gem installed
Installing ri documentation for ruby-vips-0.3.7...
Installing RDoc documentation for ruby-vips-0.3.7...
$ irb
irb(main):001:0> require 'rubygems'
=> false
irb(main):002:0> require 'vips'
=> true
irb(main):003:0> a = VIPS::Image.new("pics/img_2522.jpg")
=> #<VIPS::Image:0x00000001a0e528>
irb(main):004:0> a.get("exif-Orientation")
=> "1 (Top-left, Short, 1 components, 2 bytes)"
irb(main):005:0> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top