Sha256: f778a0e31a4706f02cc4b59c75e6e3da7ff2783a4ed91fc6711b9666a74c6bd0
Contents?: true
Size: 924 Bytes
Versions: 10
Compression:
Stored size: 924 Bytes
Contents
#! /usr/local/bin/ruby -w require 'RMagick' include Magick img = Image.new(200,200) img.compression = LZWCompression bg = Image.read('plasma:fractal') { self.size = '200x200' } bg[0].matte = false gc = Draw.new gc.stroke_width(2) gc.stroke('black') gc.fill('white') gc.roundrectangle(0, 0, 199, 199, 8, 8) gc.fill('black') gc.circle(100, 45, 100, 25) gc.circle( 45, 100, 25, 100) gc.circle(100, 155, 100, 175) gc.circle(155, 100, 175, 100) gc.draw(img) img.write('matte_replace_before.gif') # Set the border color. Set the fuzz attribute so that # the matte fill will fill the aliased pixels around # the edges of the black circles. img.border_color = 'black' img.fuzz = 10 img = img.matte_replace(100, 45) # Composite the image over a nice bright background # so that the transparent pixels will be obvious. img = bg[0].composite(img, CenterGravity, OverCompositeOp) img.write('matte_replace_after.gif') exit
Version data entries
10 entries across 10 versions & 1 rubygems