-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate.rb
More file actions
41 lines (22 loc) · 813 Bytes
/
generate.rb
File metadata and controls
41 lines (22 loc) · 813 Bytes
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
require 'pixelart'
require_relative 'base'
specs = read_csv( "./letsrock.csv" )
cols = 50
rows = specs.size / cols
rows += 1 if specs.size % cols != 0
composite = ImageComposite.new( cols, rows,
width: 28, height: 28 )
specs.each_with_index do |rec, i|
base = rec['type']
accessories = (rec['accessories'] || '' ).split( '/').map { |acc| acc.strip }
background = rec['background']
spec = ["bg #{background}", base] + accessories
img = generate( *spec )
num = "%03d" % i
puts "==> rock #{num}"
img.save( "./i/rock#{num}.png" )
img.zoom(8).save( "./i@8x/rock#{num}@8x.png" )
composite << img
end
composite.save( "./letsrock.png" )
puts "bye"