-
Notifications
You must be signed in to change notification settings - Fork 0
/
genPUPPI.py
41 lines (34 loc) · 932 Bytes
/
genPUPPI.py
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
#!/usr/bin/env python
from PIL import Image
import sys,os
def organizeGrid(inputData):
width = 0
height = 100*len(inputData)
lengths = []
for item in inputData:
lengths.append(len(item))
lengths.sort()
width = lengths[-1] * 100
outputData = []
outputData.append(width)
outputData.append(height)
return outputData
textToPuppy = sys.argv[1]
inputData = textToPuppy.split(',')
geometry = organizeGrid(inputData)
til = Image.new("RGB",(geometry[0],geometry[1]),(255, 255, 255))
row = 0
for item in inputData:
textOffSet = (geometry[0]/100 - len(item))/2
col = 0
for letter in item:
if letter == " ":
letter = "space"
im = Image.open("./cmsswConfig/" + letter + ".png")
im = im.resize((100,100), Image.ANTIALIAS)
coordinateX = (textOffSet + col)*100
coordinateY = row*100
til.paste(im, (coordinateX, coordinateY))
col = col + 1
row = row + 1
til.show()