require 'RMagick'
include Magick
images = ImageList.new
images.new_image(200, 40){
self.background_color = "none"
}
dr = Draw.new
dr.fill = "#aaccf8"
# フォント
dr.font = "Tahoma"
# ポイントサイズ
dr.pointsize = 30
dr.gravity = CenterGravity
dr.text(0, 0, "ImageMagick")
dr.draw(images)
images[0] = images.blur_channel(0,1,AllChannels)
images2 = ImageList.new()
images2.read("plasma:fractal"){
self.size = "200x40"
}
images2.alpha = ActivateAlphaChannel
images2.colorspace = GRAYColorspace
images2[0] = images2.modulate(0.8, 1, 1).
blur_channel(0,3,AllChannels)
images2[0] = images2.fx("r", AlphaChannel)
images.composite(images2, CenterGravity, 0, 0,
DstOutCompositeOp).write("sample1146a.png")
出力画像(sample1146a.png)
動作環境
ruby1.8.6, rmagick2.9.0
関連項目
ImageMagickで文字画像に半透明の濃淡をつける (convertコマンドでの同様の処理)
No comments:
Post a Comment