Sha256: 2ac964eb9048f3ca56eb3ce1016dcf0f881fe97187a8e70bcbdb7c94f37fae74

Contents?: true

Size: 710 Bytes

Versions: 67

Compression:

Stored size: 710 Bytes

Contents

#! /usr/local/bin/ruby -w
require 'RMagick'

# Demonstrate the Image#reduce_noise method

img = Magick::Image.read('images/Flower_Hat.jpg').first
img = img.add_noise(Magick::UniformNoise)

eimg = img.reduce_noise(0)

# Zoom in so we can see the change
img.resize!(3)
eimg.resize!(3)

# Make a before-and-after composite
eimg.crop!(eimg.columns/2, 0, eimg.columns/2, eimg.rows)
img = img.composite(eimg, Magick::EastGravity, Magick::OverCompositeOp)

# Draw a black line between the before and after parts.
line = Magick::Draw.new
line.line(img.columns/2, 0, img.columns/2, img.rows)
line.draw(img)

# Crop everything but the face.
img.crop!(Magick::CenterGravity, 250, 200)

img.write('reduce_noise.jpg')
exit

Version data entries

67 entries across 67 versions & 2 rubygems

Version Path
rmagick-2.13.4 doc/ex/reduce_noise.rb
rmagick-2.13.3 doc/ex/reduce_noise.rb
rmagick-2.13.3.rc1 doc/ex/reduce_noise.rb
rmagick-2.13.2 doc/ex/reduce_noise.rb
rdp-rmagick-0.0.0 doc/ex/reduce_noise.rb
rmagick-2.13.1 doc/ex/reduce_noise.rb
rmagick-2.12.2 doc/ex/reduce_noise.rb
rmagick-2.12.1 doc/ex/reduce_noise.rb
rmagick-2.12.0 doc/ex/reduce_noise.rb
rmagick-2.11.1 doc/ex/reduce_noise.rb
rmagick-2.10.0 doc/ex/reduce_noise.rb
rmagick-2.11.0 doc/ex/reduce_noise.rb
rmagick-1.10.1 doc/ex/reduce_noise.rb
rmagick-1.10.0 doc/ex/reduce_noise.rb
rmagick-1.13.0 doc/ex/reduce_noise.rb
rmagick-1.12.0 doc/ex/reduce_noise.rb
rmagick-1.11.1 doc/ex/reduce_noise.rb
rmagick-1.11.0 doc/ex/reduce_noise.rb
rmagick-1.15.10 doc/ex/reduce_noise.rb
rmagick-1.15.0 doc/ex/reduce_noise.rb