lib/mojo_magick.rb in mojo_magick-0.4.0 vs lib/mojo_magick.rb in mojo_magick-0.4.1
- old
+ new
@@ -67,10 +67,11 @@
def MojoMagick::raw_command(command, args, options = {})
# this suppress error messages to the console
err_pipe = windows? ? "2>nul" : "2>/dev/null"
begin
execute = "#{command} #{get_limits_as_params} #{args} #{err_pipe}"
+ puts execute
retval = `#{execute}`
# guarantee that only MojoError exceptions are raised here
rescue Exception => e
raise MojoError, "#{e.class}: #{e.message}"
end
@@ -193,16 +194,24 @@
self
end
alias files file
# Create a temporary file for the given image and add to command line
+ def format(*args)
+ @opts << '-format'
+ args.each do |arg|
+ add_formatted arg
+ end
+ end
+
def blob(*args)
data = args[0]
opts = args[1] || {}
- [:format, :depth, :size].each do |opt|
- self.send(opt, opts[opt].to_s) if opts[opt]
+ opts.each do |k,v|
+ send(k.to_s,v.to_s)
end
- file MojoMagick::tempfile(data, opts)
+ tmpfile = MojoMagick::tempfile(data, opts)
+ file tmpfile
end
# Generic commands. Arguments will be formatted if necessary
def method_missing(command, *args)
if command.to_s[-1, 1] == '!'