Sha256: e618686bb3a19fb1f9a2340956121b6a376d02728db9c8524c838a82890aa9d1

Contents?: true

Size: 786 Bytes

Versions: 37

Compression:

Stored size: 786 Bytes

Contents

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

# Demonstrate the Image#contrast method

img = Magick::ImageList.new('images/Flower_Hat.jpg')
img.resize!(0.5)

# Prepare to label each image with a number from 1 to 4
legend = Magick::Draw.new
legend.stroke = 'transparent'
legend.pointsize = 12
legend.gravity = Magick::SouthEastGravity

# Add 3 images, each one having slightly less contrast
f = 1
3.times {
    img << img.contrast

    # Annotate the previous image
    legend.annotate(img[f-1], 0,0,7,10, f.to_s)
    f += 1
    }

# Annotate the last image
legend.annotate(img, 0,0,7,10, f.to_s)

# Montage into a single image
imgs = img.montage {
    self.geometry = Magick::Geometry.new(img.columns, img.rows)
    self.tile = "2x2"
    }

imgs.write('contrast.jpg')
#imgs.display
exit

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
rmagick-2.13.4 doc/ex/contrast.rb
rmagick-2.13.3 doc/ex/contrast.rb
rmagick-2.13.3.rc1 doc/ex/contrast.rb
rmagick-2.13.2 doc/ex/contrast.rb
rdp-rmagick-0.0.0 doc/ex/contrast.rb
rmagick-2.13.1 doc/ex/contrast.rb
rmagick-2.12.2 doc/ex/contrast.rb
rmagick-2.12.1 doc/ex/contrast.rb
rmagick-2.12.0 doc/ex/contrast.rb
rmagick-2.11.1 doc/ex/contrast.rb
rmagick-2.10.0 doc/ex/contrast.rb
rmagick-2.11.0 doc/ex/contrast.rb
rmagick-1.15.10 doc/ex/contrast.rb
rmagick-1.15.12 doc/ex/contrast.rb
rmagick-1.15.14 doc/ex/contrast.rb
rmagick-1.15.15 doc/ex/contrast.rb
rmagick-1.15.13 doc/ex/contrast.rb
rmagick-1.15.11 doc/ex/contrast.rb
rmagick-1.15.16 doc/ex/contrast.rb
rmagick-1.15.17 doc/ex/contrast.rb