#! /usr/local/bin/ruby -w
require 'RMagick'

# Demonstrate the Image#implode method

jj = Magick::Image.read('images/Jean_Jacket.jpg').first
jj = jj.scale(250.0/jj.rows)

# You can implode or explode by specifying a negative argument.
# Do both, and add a label so it's easy to see which is which.
jjsmall = jj.implode(0.25)
jjsmall['Label'] = 'implode(0.25)'
jjbig = jj.implode(-.5)
jjbig['Label'] = 'implode(-0.5)'

# Prepare to make a montage by adding both images
# to an ImageList object.
res = Magick::ImageList.new
res << jjsmall
res << jjbig

both = res.montage {
    self.geometry = "#{res.columns}x#{res.rows}+5+5"
    self.tile = "2x1"
    }
    
# Give the montage a black border
both = both.border(1,1,'black')

#both.display
both.write('implode.jpg')
exit