File: implode.rb

package info (click to toggle)
librmagick-ruby 2.13.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,444 kB
  • ctags: 1,716
  • sloc: ansic: 16,755; ruby: 9,730; makefile: 16; sh: 12
file content (34 lines) | stat: -rw-r--r-- 713 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/local/bin/ruby -w

require 'RMagick'

img = Magick::Image.read('images/Flower_Hat.jpg').first

legend = Magick::Draw.new
legend.stroke = 'transparent'
legend.fill = 'white'
legend.gravity = Magick::SouthGravity

frames = Magick::ImageList.new

implosion = 0.25
8.times {
    frames << img.implode(implosion)
    legend.annotate(frames, 0,0,10,20, sprintf("% 4.2f", implosion))
    frames.matte = false
    implosion -= 0.10
    }

7.times {
    implosion += 0.10
    frames << img.implode(implosion)
    legend.annotate(frames, 0,0,10,20, sprintf("% 4.2f", implosion))
    frames.matte = false
    }

frames.delay = 10
frames.iterations = 0
puts "Producing animation..."

frames.write("implode.gif")
exit