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" ...

Get Wicked Cool Ruby Scripts now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.