require "open-uri" require "tempfile" require "stringio" module MiniMagick VERSION = '1.0.1' class MiniMagickError < Exception end class Image attr :path # Attributes # ---------- def width info[:width] end def height info[:height] end def format info[:format] end # Class Methods # ------------- class < info_array[1], :width => info_array[2].match(/^\d+/)[0].to_i, :height => info_array[2].match(/\d+$/)[0].to_i } end def run_command(command, *args) args = args.collect {|a| a.to_s} output = `#{command} #{args.join(' ')}` if $? != 0 raise MiniMagickError, "ImageMagick command (#{command} #{args.join(' ')}) failed: Error Given #{$?}" else return output end end end class CommandBuilder attr :args def initialize @args = [] end def method_missing(symbol, *args) @args += ["-#{symbol}"] + args end end end