require 'RMagick'
include Magick
images = ImageList.new("sf.jpg")
10.times {
images2 = ImageList.new
images2.new_image(images.columns, images.rows){
self.background_color = "none"
}
images2.alpha = ActivateAlphaChannel
dr = Draw.new
cx = rand() * images.columns
cy = rand() * images.columns
rv = rand()
dr.fill = "#ffffff80"
rad = 40*rv
dr.ellipse(cx, cy,rad, rad, 0, 360)
dr.draw(images2);
images[0] = images.composite(
images2.blur_channel(0,7*rv,AllChannels),
CenterGravity, 0, 0,
OverCompositeOp)
}
images.write("sample1089a.png")
exit
元画像(sf.jpg)
出力画像(sample1089a.png)
動作環境
ruby1.8.6, rmagick2.9.0
No comments:
Post a Comment