Sha256: ead94a2708f73d46409a97a3bfb8f3090ca9aa75565bd2072e4e739a43e3872e

Contents?: true

Size: 657 Bytes

Versions: 13

Compression:

Stored size: 657 Bytes

Contents

#!/usr/bin/env 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

13 entries across 13 versions & 3 rubygems

Version Path
rmagick-windows-2.16.5 doc/ex/mosaic.rb
rmagick-windows-2.16.4 doc/ex/mosaic.rb
rmagick-windows-2.16.3 doc/ex/mosaic.rb
rmagick-windows-2.16.2 doc/ex/mosaic.rb
rmagick-windows-2.16.1 doc/ex/mosaic.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0/doc/ex/mosaic.rb
rmagick-2.16.0 doc/ex/mosaic.rb
rmagick-2.15.4 doc/ex/mosaic.rb
rmagick-2.15.3 doc/ex/mosaic.rb
rmagick-2.15.2 doc/ex/mosaic.rb
rmagick-2.15.1 doc/ex/mosaic.rb
rmagick-2.15.0 doc/ex/mosaic.rb
rmagick-2.14.0 doc/ex/mosaic.rb