Closed tomasc closed 7 years ago
PS the autorotate
flag works correctly
Try this:
require 'vips'
img = Vips::Image.new_from_file('FOO.JPG')
# Check if it has a orientation tag
if img.get_typeof("orientation") != 0
# Output the int from 1 - 8 using the standard exif/tiff meanings
puts img.get("orientation")
else
puts "No orientation tag"
end
Not long ago I had the same problem (with php), see: https://github.com/jcupitt/php-vips/issues/13#issuecomment-252412013.
Kleis is right, the orientation
tag is the new official way to do this.
But using the ifd should have worked too, it sounds like a case might be missing from the thing to read values. I'll have a look.
Yes, the vips reference counted string gtype was missing. I now see:
$ irb
irb(main):001:0> require 'vips'
=> true
irb(main):002:0> x = Vips::Image.new_from_file "/home/john/pics/k2.jpg"
=> #<Image 1450x2048 uchar, 3 bands, srgb>
irb(main):003:0> x.get "exif-ifd0-Orientation"
=> "1 (Top-left, Short, 1 components, 2 bytes)"
I'll add a test and push a new version. Thanks for reporting this dumbness!
v2.0.1 push to rubygems
Wonderful, thanks! I will give it a test right now.
Just to confirm, all works fine now. Thanks again.
@jcupitt perhaps something to do with the
ffi
rewrite?