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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.