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.10.0 doc/ex/map.rb
rmagick-1.10.1 doc/ex/map.rb
rmagick-1.13.0 doc/ex/map.rb
rmagick-1.12.0 doc/ex/map.rb
rmagick-1.11.0 doc/ex/map.rb
rmagick-1.11.1 doc/ex/map.rb
rmagick-1.15.0 doc/ex/map.rb
rmagick-1.14.0 doc/ex/map.rb
rmagick-1.15.1 doc/ex/map.rb
rmagick-1.15.10 doc/ex/map.rb
rmagick-1.14.1 doc/ex/map.rb
rmagick-1.15.13 doc/ex/map.rb
rmagick-1.15.14 doc/ex/map.rb
rmagick-1.15.12 doc/ex/map.rb
rmagick-1.15.11 doc/ex/map.rb
rmagick-1.15.15 doc/ex/map.rb
rmagick-1.15.17 doc/ex/map.rb
rmagick-1.15.2 doc/ex/map.rb
rmagick-1.15.16 doc/ex/map.rb
rmagick-1.15.3 doc/ex/map.rb