 |  |

 |
 |  |  |
 | Welcome to CS1315. Click on the python to add comments.
|  |
 |  |  |
|
This page removed for FERPA compliance
|
        |
Text To Image Converter
| Whoops, didn't realize this was some avant-garde gibbish generator. REMOVED's my mostly debugged and rewritten version. Student2243 |
def stringToImage(string, size):
'''input string, input magic number, output picture'''
alpha = {'a':0, 'b':1, 'c':2, 'd':3, 'e':4, 'f':5, 'g':6, 'h':7, 'i':8, 'j':9,
'k':10, 'l':11, 'm':12, 'n':13, 'o':14, 'p':15, 'q':16, 'r':17, 's':18,
't':19, 'u':20, 'v':21, 'w':22, 'x':23, 'y':24, 'z':25}
string = string.lower()
canvas = makePicture(getMediaPath('7inX95in.jpg'))
x = canvas.getWidth()/2
y = canvas.getHeight()/2
inc = (2*pi)/26
for letter in string:
if alpha.has_key(letter):
x0 = x + int((size*cos(alpha[letter]*inc)))
y0 = y + int((size*sin(alpha[letter]*inc)))
addREMOVEDne(canvas, x, y, x0, y0)
x = x0
y = y0
show(canvas)
return canvas
Takes length of line as input. Try 5-20 for best results. May need to use 2-3 for larger text inputs. Create a document.txt in your JES folder. This file will contain the text you wish to convert.