Sha256: ac5f47057bf32f54fe4675fc97ece1aaba4f5eb6fb04f5417a9ae772c21f0cc9

Contents?: true

Size: 695 Bytes

Versions: 67

Compression:

Stored size: 695 Bytes

Contents

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

# Demonstrate the mosaic method

a = Magick::ImageList.new

letter = 'A'
26.times do
    # 'M' is not the same size as the other letters.
    if letter != 'M'
        a.read("images/Button_"+letter+".gif")
    end
    letter.succ!
end

# Make a copy of "a" with all the images quarter-sized
b = Magick::ImageList.new
page = Magick::Rectangle.new(0,0,0,0)
a.scene = 0
5.times do |i|
    5.times do |j|
        b << a.scale(0.25)
        page.x = j * b.columns
        page.y = i * b.rows
        b.page = page
        (a.scene += 1) rescue a.scene = 0
    end
end

# Make a 5x5 mosaic
mosaic = b.mosaic
mosaic.write("mosaic.gif")
# mosaic.display
exit

Version data entries

67 entries across 67 versions & 2 rubygems

Version Path
rmagick-2.7.0 doc/ex/mosaic.rb
rmagick-2.7.1 doc/ex/mosaic.rb
rmagick-2.7.2 doc/ex/mosaic.rb
rmagick-2.8.0 doc/ex/mosaic.rb
rmagick-2.9.0 doc/ex/mosaic.rb
rmagick-2.9.1 doc/ex/mosaic.rb
rmagick-2.9.2 doc/ex/mosaic.rb