Created
May 13, 2014 18:14
-
-
Save oropon/bfef9248e0a0020bb67b to your computer and use it in GitHub Desktop.
annotate fname
This file contains hidden or 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
require 'RMagick' | |
include Magick | |
id_min = 0 | |
id_max = 10 | |
def annotate_id img, id | |
fname = "Octcat_%03d.png" % id | |
text = Draw.new | |
text.font = '/System/Library/Fonts/Avenir Next.ttc' | |
text.pointsize = 100 | |
text.gravity = CenterGravity | |
text.annotate(img, 0,0,0,0, fname) { | |
# 画像の色にかかわらず文字が読めるように縁取りする | |
self.stroke_width = 3 | |
self.stroke = 'white' | |
self.fill = 'gray30' | |
} | |
img.write(fname) | |
end | |
img = ImageList.new 'octcat.png' | |
id_min.upto(id_max) do |i| | |
annotate_id img.copy, i | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment