-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathwizard.rb
70 lines (46 loc) · 1.43 KB
/
wizard.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
58
59
60
61
62
63
64
65
66
67
68
69
70
###########
# to run use:
# ruby ./wizard.rb
$LOAD_PATH.unshift( "../cryptopunks/lib" )
require 'cryptopunks'
wizard = Image.parse( <<TXT, colors: ['5F5297', '7966AB', '8B80B7', 'F1EA49'] )
. . . . . . . x o o o . . . .
. . . . . . @ x x x x o . . .
. . . . . @ @ x x ^ x x o . .
. . . . @ @ x x x x x @ @ @ .
. . . . @ x ^ x x x @ . . @ @
. . . @ @ x x x x x @ @ . . @
. . . @ x x x x x ^ x @ . . .
. . @ @ @ @ @ @ @ @ @ @ @ . .
. @ x x x x x x x x x x x @ .
@ @ @ @ @ @ @ @ @ @ @ @ @ @ @
TXT
wizard.save( './i/wizard.png' )
wizard.zoom(4).save( './i/wizard4x.png' )
## bonus - save wizard hat as 24x24 attribute for easy (re)use
img = Image.new( 24, 24 )
img.compose!( wizard, 4, 0 )
img.save( './tmp/wizardhat.png' )
img.zoom(4).save( './tmp/[email protected]' )
designs = [
'human-male!lighter',
'human-male!light',
'human-male!dark',
'human-male!darker',
'zombie-male',
'ape-male',
'alien-male',
]
designs.each do |design|
punk = Punks::Image.new( design: design )
name = design.sub( '!', '_') ## note: change human-male!lighter to human-male_lighter
punk.save( "./i/design-#{name}.png" )
end
designs.each do |design|
punk = Punks::Image.new( design: design )
punk.compose!( wizard, 4, 0 )
name = design.sub( '!', '_') ## note: change human-male!lighter to human-male_lighter
punk.save( "./i/punk_wizard-#{name}.png" )
punk.zoom(4).save( "./i/punk_wizard-#{name}x4.png" )
end
puts "bye"