O'Reilly logo

Wicked Cool Ruby Scripts by Steve Pugh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a Watermark to Pictures

Adding a Watermark to Pictures

watermark.rb

If you want to receive credit for your pictures while sharing them on the Internet, watermarks are a nice tool (see Figure 4-1). Watermarks help ensure you remain the owner of your digital property. If there is a standard watermark you use, this script can incorporate it—big or small.

Cover image with watermark

Figure 4-1. Cover image with watermark

The Code

 require 'RMagick'
 include Magick

 unless ARGV[0] and File.exists?(ARGV[0])
     puts "\n\n\nYou need to specify a filename:  watermark.rb <filename>\n\n\n" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required