Sha256: d4624df65760e854aca885282d2128a0365c90923b372765d064a71a011b6df5

Contents?: true

Size: 688 Bytes

Versions: 13

Compression:

Stored size: 688 Bytes

Contents

#!/usr/bin/env ruby -w

# Demonstrate the ImageList#quantize method

require 'rmagick'

snapshots = Magick::ImageList.new 'images/Ballerina.jpg','images/Gold_Statue.jpg','images/Shorts.jpg'

# Quantize all 3 images to a single set of 16 colors in the RGB colorspace
$stdout.sync=true
printf 'Quantizing... Please be patient, this may take a couple of seconds... '
quant = snapshots.quantize 16
puts 'Done.'

# Now we create the "before" and "after" images.
# Arrange the original images side-by-side into a
# single image.
old = snapshots.append false
old.write('quantize-m_before.jpg')

# Repeat for the quantized images.
new = quant.append false
new.write('quantize-m_after.jpg')

exit

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
rmagick-windows-2.16.5 doc/ex/quantize-m.rb
rmagick-windows-2.16.4 doc/ex/quantize-m.rb
rmagick-windows-2.16.3 doc/ex/quantize-m.rb
rmagick-windows-2.16.2 doc/ex/quantize-m.rb
rmagick-windows-2.16.1 doc/ex/quantize-m.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0/doc/ex/quantize-m.rb
rmagick-2.16.0 doc/ex/quantize-m.rb
rmagick-2.15.4 doc/ex/quantize-m.rb
rmagick-2.15.3 doc/ex/quantize-m.rb
rmagick-2.15.2 doc/ex/quantize-m.rb
rmagick-2.15.1 doc/ex/quantize-m.rb
rmagick-2.15.0 doc/ex/quantize-m.rb
rmagick-2.14.0 doc/ex/quantize-m.rb