Created
March 24, 2012 10:32
-
-
Save dannvix/2180929 to your computer and use it in GitHub Desktop.
Paint text on given image with RMagick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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