Sha256: 911aabe651361e975fcbbe6279327ce100f3ba44173cbeb090a837fc1eaaa743

Contents?: true

Size: 739 Bytes

Versions: 13

Compression:

Stored size: 739 Bytes

Contents

# Ccreate a semi-transparent title for an image.

require 'rmagick'
include Magick

puts <<END_INFO

This example uses a semi-transparent background color to create a title.
View the resulting image by entering the command: display image_opacity.miff

END_INFO

balloons = Image.read('../doc/ex/images/Hot_Air_Balloons_H.jpg').first
legend = Image.new(160, 50) { self.background_color = '#ffffffc0' }

gc = Draw.new
gc.annotate(legend, 0, 0, 0, 0, 'Balloon Day!\\nFri May 2 2003') do
  self.gravity = CenterGravity
  self.stroke = 'transparent'
  self.fill = 'white'
  self.pointsize = 18
end

result = balloons.composite(legend, SouthGravity, OverCompositeOp)

puts '...Writing image_opacity.miff'
result.write 'image_opacity.miff'
exit

Version data entries

13 entries across 13 versions & 3 rubygems

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