Sha256: 5949805165459db4ef3c37c367b69cab4c582e0467612dd53bf6147889e72259

Contents?: true

Size: 825 Bytes

Versions: 47

Compression:

Stored size: 825 Bytes

Contents

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

# Demonstrate the map, append, and composite methods by
# mapping the colors in three separate images into the
# 216 "Web-safe" colors.

require 'RMagick'

# Read three images.
unmapped = Magick::ImageList.new("images/Hot_Air_Balloons.jpg","images/Violin.jpg","images/Polynesia.jpg")

# "Read" the Netscape 216-color cube
map = Magick::ImageList.new "netscape:"

# Map the group of unmapped into the Netscape colors
$stdout.sync = true
printf "Mapping... Please be patient, this may take a few seconds... "
mapped = unmapped.map map, false
puts "Done."

# Use the append method to arrange the unmapped images
# side-by-side into a single image. Repeat for the mapped images.
before = unmapped.append false
before.write 'map_before.jpg'

after = mapped.append false
after.write 'map_after.jpg'
exit

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
rmagick-1.15.4 doc/ex/map.rb
rmagick-1.15.7 doc/ex/map.rb
rmagick-1.15.5 doc/ex/map.rb
rmagick-1.15.6 doc/ex/map.rb
rmagick-1.15.8 doc/ex/map.rb
rmagick-1.7.1 doc/ex/map.rb
rmagick-1.7.2 doc/ex/map.rb
rmagick-1.7.4 doc/ex/map.rb
rmagick-1.7.3 doc/ex/map.rb
rmagick-1.8.1 doc/ex/map.rb
rmagick-1.8.0 doc/ex/map.rb
rmagick-1.15.9 doc/ex/map.rb
rmagick-1.8.2 doc/ex/map.rb
rmagick-1.8.3 doc/ex/map.rb
rmagick-1.9.0 doc/ex/map.rb
rmagick-1.9.1 doc/ex/map.rb
rmagick-1.9.2 doc/ex/map.rb
rmagick-1.9.3 doc/ex/map.rb
rmagick-2.3.0 doc/ex/map.rb
rmagick-2.1.0 doc/ex/map.rb