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-2.0.0 doc/ex/map.rb
rmagick-2.2.0 doc/ex/map.rb
rmagick-2.2.2 doc/ex/map.rb
rmagick-2.5.1 doc/ex/map.rb
rmagick-2.4.0 doc/ex/map.rb
rmagick-2.5.2 doc/ex/map.rb
rmagick-2.5.0 doc/ex/map.rb