-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathwhales.rb
70 lines (45 loc) · 1.71 KB
/
whales.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
require 'pixelart'
require 'backgrounds'
whale = Image.read( "./whale-24x24.png")
whales_i = ImageComposite.new( 2, 2 )
whales_i << whale.background( 'white' )
whales_i << whale.background( '#638596' ).mirror
whales_i << whale.background( 'pride' )
whales_i << whale.background( 'ukraine' )
whales_i.save( "./tmp/whales_vol1.png" )
whales_i.zoom(2).save( "./tmp/[email protected]" )
whales_i.zoom(8).save( "./tmp/[email protected]" )
YELLOW = '#ffff00'
GREEN = '#00ff00'
RED = '#ff0000'
BLUE = '#0000ff'
WHALE2X = Image.read( "./[email protected]")
TOPHAT = Image.read( "./attributes/tophat-48x48.png" )
BEANIE = Image.read( "./attributes/beanie-48x48.png" )
HEADBAND = Image.read( "./attributes/headband-48x48.png" )
CAP = Image.read( "./attributes/cap-48x48.png" )
def gen_whale2x( *attributes )
whale = Image.new( 48, 48 )
whale.compose!( WHALE2X )
attributes.each do |attribute|
whale.compose!( attribute )
end
whale
end
whales_ii = ImageComposite.new( 2, 2,
width: 48,
height: 48,
background: [YELLOW, GREEN, RED, BLUE] )
whales_ii << gen_whale2x( CAP )
whales_ii << gen_whale2x( HEADBAND )
whales_ii << gen_whale2x( TOPHAT )
whales_ii << gen_whale2x( BEANIE )
whales_ii.save( "./tmp/whales_vol2.png" )
whales_ii.zoom(4).save( "./tmp/[email protected]" )
composite = ImageComposite.new( 2, 1, width: 96,
height: 96)
composite << whales_i.zoom(2)
composite << whales_ii
composite.save( "./tmp/whales.png" )
composite.zoom(3).save( "./tmp/[email protected]" )
puts "bye"