require 'RMagick'
include Magick
images = ImageList.new("sf.jpg")
images.alpha = ActivateAlphaChannel
images2 = ImageList.new
images2.new_image(20, 20){
self.background_color = "none"
}
dr = Draw.new
dr.fill = "white"
dr.roundrectangle(0,0,18,18,4,4);
dr.draw(images2)
images3 = ImageList.new()
images3.new_image(images.columns, images.rows,
TextureFill.new(images2))
images3.alpha = ActivateAlphaChannel
images3.virtual_pixel_method = TileVirtualPixelMethod
images3[0] = images3.distort(ScaleRotateTranslateDistortion, [20])
images.composite(images3, CenterGravity, 0, 0,
DstInCompositeOp).write("sample1148a.png")
exit
元画像(sf.jpg)
出力画像(sample1148a.png)
動作環境
ruby1.8.6, rmagick2.9.0
No comments:
Post a Comment