Skip to content

Instantly share code, notes, and snippets.

@dannvix
Created March 24, 2012 10:32
Show Gist options
  • Save dannvix/2180929 to your computer and use it in GitHub Desktop.
Save dannvix/2180929 to your computer and use it in GitHub Desktop.
Paint text on given image with RMagick
#!/usr/bin/env ruby
# encoding: utf-8
require 'RMagick'
include Magick
image = Image.read("image.png").first
text = Draw.new
text.annotate(image, 0, 0, 0, 60, "測試!Test!") {
self.encoding = 'Unicode'
self.font_family = 'LiHei Pro'
self.gravity = SouthGravity
self.pointsize = 24
self.stroke = 'transparent'
self.fill = '#AA0000'
}
image.display
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment