Sha256: c35ab807a2e4efa5158fc188df9dcc38bc66eb386dc83ecee3220138f6211f4a

Contents?: true

Size: 736 Bytes

Versions: 67

Compression:

Stored size: 736 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") {
  self.gravity = CenterGravity
  self.stroke = 'transparent'
  self.fill = 'white'
  self.pointsize = 18
}

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

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

Version data entries

67 entries across 67 versions & 2 rubygems

Version Path
rmagick-2.13.4 examples/image_opacity.rb
rmagick-2.13.3 examples/image_opacity.rb
rmagick-2.13.3.rc1 examples/image_opacity.rb
rmagick-2.13.2 examples/image_opacity.rb
rdp-rmagick-0.0.0 examples/image_opacity.rb
rmagick-2.13.1 examples/image_opacity.rb
rmagick-2.12.2 examples/image_opacity.rb
rmagick-2.12.1 examples/image_opacity.rb
rmagick-2.12.0 examples/image_opacity.rb
rmagick-2.11.1 examples/image_opacity.rb
rmagick-2.10.0 examples/image_opacity.rb
rmagick-2.11.0 examples/image_opacity.rb
rmagick-1.10.1 examples/image_opacity.rb
rmagick-1.10.0 examples/image_opacity.rb
rmagick-1.12.0 examples/image_opacity.rb
rmagick-1.11.1 examples/image_opacity.rb
rmagick-1.11.0 examples/image_opacity.rb
rmagick-1.13.0 examples/image_opacity.rb
rmagick-1.14.1 examples/image_opacity.rb
rmagick-1.15.0 examples/image_opacity.rb