-
Notifications
You must be signed in to change notification settings - Fork 7
/
generate_presidents.rb
57 lines (41 loc) · 1.2 KB
/
generate_presidents.rb
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'pixelart'
require_relative 'base'
specs = parse_data( <<DATA )
joe
joe (a), cap blue
joe, clown eyes blue, clown nose
joe, 3d glasses
joe, regular shades
joe (a), cap blue, regular shades
joe, laser eyes
donald
donald (a), cap red
donald (a), cap mcd
donald, clown eyes green, clown nose
donald, 3d glasses
donald, laser eyes
donald, regular shades
nikki
nikki (a)
nikki, big shades, earring
nikki, 3d glasses
nikki, laser eyes, gold chain
nikki (a), vr
nikki (b), hoodie red
DATA
cols = 7
rows = specs.size / cols
rows += 1 if specs.size % cols != 0
composite = ImageComposite.new( cols, rows,
width: 12, height: 12 )
specs.each_with_index do |spec, i|
img = generate( *spec)
img.save( "./tmp/president#{i}.png" )
img.zoom(10).save( "./tmp/@10x/president#{i}@10x.png" )
img.zoom(20).save( "./tmp/@20x/president#{i}@20x.png" )
composite << img
end
composite.save( "./tmp2/presidents.png" )
composite.zoom(4).save( "./tmp2/presidents@4x.png" )
composite.zoom(10).save( "./tmp2/presidents@10x.png" )
puts "bye"