Sha256: f23ae2a4fcd21994d0996c5b8f0a62f6dd018862b6e19103862f99c849602328

Contents?: true

Size: 565 Bytes

Versions: 20

Compression:

Stored size: 565 Bytes

Contents

#! /usr/local/bin/ruby -w

require 'RMagick'

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

# Convert to grayscale
sketch = img.quantize(256, Magick::GRAYColorspace)

# Apply histogram equalization
sketch = sketch.equalize

# Sketch, then dissolve 25% of the original back in
begin
    sketch = sketch.sketch(0, 10, 135)
    img = img.dissolve(sketch, 0.75, 0.25)

rescue NotImplementedError
    not_impl = Magick::Image.read('images/notimplemented.gif').first
    not_impl.resize!(img.columns, img.rows)
    img = not_impl
end

img.write('sketch.jpg')

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rmagick-1.15.1 doc/ex/sketch.rb
rmagick-1.14.1 doc/ex/sketch.rb
rmagick-1.15.10 doc/ex/sketch.rb
rmagick-1.14.0 doc/ex/sketch.rb
rmagick-1.15.0 doc/ex/sketch.rb
rmagick-1.15.14 doc/ex/sketch.rb
rmagick-1.15.11 doc/ex/sketch.rb
rmagick-1.15.12 doc/ex/sketch.rb
rmagick-1.15.13 doc/ex/sketch.rb
rmagick-1.15.15 doc/ex/sketch.rb
rmagick-1.15.3 doc/ex/sketch.rb
rmagick-1.15.16 doc/ex/sketch.rb
rmagick-1.15.17 doc/ex/sketch.rb
rmagick-1.15.2 doc/ex/sketch.rb
rmagick-1.15.4 doc/ex/sketch.rb
rmagick-1.15.8 doc/ex/sketch.rb
rmagick-1.15.6 doc/ex/sketch.rb
rmagick-1.15.5 doc/ex/sketch.rb
rmagick-1.15.7 doc/ex/sketch.rb
rmagick-1.15.9 doc/ex/sketch.rb