require 'RMagick'
include Magick
images = ImageList.new("sf.jpg")
images2 = ImageList.new
images2.new_image(images.columns-50, images.rows-50){
self.background_color = "white"
}
dr = Draw.new
dr.fill = "black"
# フォント
dr.font = "Tahoma"
# ポイントサイズ
dr.pointsize = 120
dr.gravity = CenterGravity
dr.text(0, 0, "SF")
dr.draw(images2)
images2[0] = images2.fx("r*0.5", AlphaChannel)
images2[0] = images2.fx("#000000", DefaultChannels)
images.composite(images2, CenterGravity, 0, 0,
OverCompositeOp).write("sample996a.png")
exit
(sf.jpg)
出力画像(sample996a.png)
動作環境
ruby1.8.6, rmagick2.9.0
No comments:
Post a Comment