Method: MiniMagick::Tool#stack

Defined in:
lib/mini_magick/tool.rb

#stack(*args) {|_self| ... } ⇒ Object

Create an ImageMagick stack in the command (surround.

Examples:

MiniMagick.convert do |convert|
  convert << "wand.gif"
  convert.stack do |stack|
    stack << "wand.gif"
    stack.rotate(30)
  end
  convert.append.+
  convert << "images.gif"
end
# executes `convert wand.gif \( wizard.gif -rotate 30 \) +append images.gif`

Yields:

  • (_self)

Yield Parameters:



183
184
185
186
187
188
189
190
191
192
193
# File 'lib/mini_magick/tool.rb', line 183

def stack(*args)
  self << "("
  args.each do |value|
    case value
    when Hash   then value.each { |key, value| send(key, *value) }
    when String then self << value
    end
  end
  yield self if block_given?
  self << ")"
end