Skip to content

Instantly share code, notes, and snippets.

@blat
Created February 25, 2011 17:05
Show Gist options
  • Save blat/844097 to your computer and use it in GitHub Desktop.
Save blat/844097 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "RMagick"
ARGV.each do |file|
image = Magick::Image.read(file).first
image = image.resize_to_fit(996, 996)
if image.orientation == Magick::LeftBottomOrientation then
image.orientation = Magick::TopLeftOrientation
image = image.rotate(-90)
end
watermark = Magick::Draw.new
watermark.annotate(image, 0, 0, 10, 10, '© Mickael BLATIERE') do
self.gravity = Magick::SouthEastGravity
self.pointsize = 20
self.font_family = 'Trebuchet MS'
self.fill = '#ffffff'
end
image.border!(2, 2, '#ffffff')
image.border!(12, 12, '#000000')
out = file.gsub(/\./, '-wmr.')
image.write(out)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment