You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
301 B
Ruby
16 lines
301 B
Ruby
10 years ago
|
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
|