Sha256: c895faf4ce9810bf29b385a76d70de7701de832887b92de22e2ecf13ea71423a
Contents?: true
Size: 763 Bytes
Versions: 2
Compression:
Stored size: 763 Bytes
Contents
#! /usr/local/bin/ruby -w require "RMagick" img = Magick::Image.read("images/Flower_Hat.jpg").first # Make a watermark from the word "RMagick" mark = Magick::Image.new(140, 40) {self.background_color = "none"} gc = Magick::Draw.new if RUBY_PLATFORM =~ /mswin32/ offset = -5 else offset = -35 end gc.annotate(mark, 0, 0, 0, offset, "RMagick") do gc.gravity = Magick::CenterGravity gc.pointsize = 32 if RUBY_PLATFORM =~ /mswin32/ gc.font_family = "Georgia" else gc.font_family = "Times" end gc.fill = "white" gc.stroke = "none" end mark = mark.wave(2.5, 70).rotate(-90) # Composite the watermark in the lower right (southeast) corner. img2 = img.watermark(mark, 0.25, 0, Magick::SouthEastGravity) img2.write("watermark.jpg")
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rmagick-1.15.10 | doc/ex/watermark.rb |
rmagick-1.15.11 | doc/ex/watermark.rb |