asciinema.org/app/services/image_inspector.rb
2015-03-29 14:15:05 +00:00

16 lines
301 B
Ruby

require 'open3'
class ImageInspector
def get_size(image_path)
o, e, t = Open3.capture3(%(identify -format "%[fx:w]x%[fx:h]" #{image_path}))
if t.exitstatus != 0
raise RuntimeError, "Couldn't inspect image #{image_path}:\n#{o}\n#{e}"
end
o.split('x').map(&:to_i)
end
end