Sha256: c092a9ea78d59dd5171d60af1fcb05c43a50f8756eadfc094bc5a6cb79833b3d

Contents?: true

Size: 588 Bytes

Versions: 19

Compression:

Stored size: 588 Bytes

Contents

require 'rmagick'

# Create a transparent image to tile over the background image.
wm = Magick::Image.read('xc:none') { self.size = '100x50' }.first

# Draw "RMagick" in semi-transparent text on the transparent image.
gc = Magick::Draw.new
gc.fill '#ffffff7f'
gc.font_weight Magick::BoldWeight
gc.font_size 18
gc.rotate 15
gc.gravity Magick::CenterGravity
gc.text 0, 0, 'RMagick'
gc.draw wm

# Read the background image.
img = Magick::Image.read('images/Flower_Hat.jpg').first

# Composite the tile image over the background image.
img.composite_tiled! wm
img.write 'composite_tiled.jpg'

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
rmagick-4.1.0.rc2 doc/ex/composite_tiled.rb
rmagick-4.1.0.rc1 doc/ex/composite_tiled.rb
rmagick-4.0.0 doc/ex/composite_tiled.rb
rmagick-3.2.0 doc/ex/composite_tiled.rb
rmagick-3.1.0 doc/ex/composite_tiled.rb
rmagick-3.0.0 doc/ex/composite_tiled.rb
rmagick-windows-2.16.5 doc/ex/composite_tiled.rb
rmagick-windows-2.16.4 doc/ex/composite_tiled.rb
rmagick-windows-2.16.3 doc/ex/composite_tiled.rb
rmagick-windows-2.16.2 doc/ex/composite_tiled.rb
rmagick-windows-2.16.1 doc/ex/composite_tiled.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0/doc/ex/composite_tiled.rb
rmagick-2.16.0 doc/ex/composite_tiled.rb
rmagick-2.15.4 doc/ex/composite_tiled.rb
rmagick-2.15.3 doc/ex/composite_tiled.rb
rmagick-2.15.2 doc/ex/composite_tiled.rb
rmagick-2.15.1 doc/ex/composite_tiled.rb
rmagick-2.15.0 doc/ex/composite_tiled.rb
rmagick-2.14.0 doc/ex/composite_tiled.rb