【发布时间】:2014-02-04 18:31:02
【问题描述】:
我正在尝试从ruby-vips gem 获取图像 EXIF 数据,但我不断收到错误消息。我找到了 documentation from others 尝试修复此问题的人,我尝试了他们的修复但没有成功。
i=VIPS::Image.new("/home/eric/Pictures/golden-clouds-wallpaper.jpg")
i.get("exif-Orientation")
i.get("exif-ifd0-Orientation")
两者都报错:
VIPS error: vips_image_get: field "exif-Orientation" not found
VIPS error: vips_image_get: field "exif-ifd0-Orientation" not found
Ubuntu 版本 13.10
贵宾版本 7.28.5
ruby-vips 0.3.7
编辑
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>'
【问题讨论】:
-
对于那些希望自动定位图像的人,请查看Rmagick#auto_orient,为我节省了大量时间。
-
谢谢,是的,Rmagick#auto_orient 运行良好,但这是关于 vips gem 的主题。以前,我使用 Rmagick,但我的图像处理时间是 VIPS 的 10 倍。权衡是 Vips Gem 不支持开箱即用的 auto_orient。
-
事后看来,你是完全正确的,不知道我为什么在这里发表这条评论。也许只是作为一种选择。不过,很高兴知道 VIPS 的效率有多高,谢谢!