Tim Hunter
4/7/2005 11:40:00 PM
Joe Van Dyk wrote:
> Hi,
>
> I'd like to generate a thumbnail of an image. The thumbnail should
> have curved corners (corners colored a specified color). Any ideas on
> what functions I could use?
>
> Thanks,
> Joe
>
>
Here's a script that adds transparent round corners.
require 'RMagick'
include Magick
hat = Image.read('Flower_Hat.jpg').first
hat.resize!(0.5)
mask = Image.new(hat.columns, hat.rows) {self.background_color = 'black'}
gc = Draw.new
gc.stroke('white').fill('white')
gc.roundrectangle(0, 0, hat.columns-1, hat.rows-1, 20, 20)
gc.draw(mask)
mask.matte = false
hat.matte = true
thumb = hat.composite(mask, CenterGravity, CopyOpacityCompositeOp)
thumb.display