blob: 371de1ccc328a348d501b53db643660729a2a8ce [file] [log] [blame]
#!/usr/bin/env python
import gd, os, cStringIO, urllib2, sys
fontlist = [
'/usr/lib/python2.4/site-packages/reportlab/fonts/PenguinAttack.ttf'
'/usr/share/fonts/truetype/freefont/FreeSans.ttf',
'/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf',
]
fontpath = '.'
for f in fontlist:
if os.path.exists(f):
fontpath = fontpath + ':' + os.path.dirname(f)
FONT = os.path.basename(f)
break
os.environ["GDFONTPATH"] = fontpath
try:
FONT
except NameError:
print "no fonts found"
sys.exit(1)
def simple():
im = gd.image((20,200))
white = im.colorAllocate((255, 255, 255))
black = im.colorAllocate((0, 0, 0))
#im.colorTransparent(white)
im.interlace(1)
im.string_ttf(FONT, 10.0, 1.56, (15, 190), sys.argv[1], black)
f=open(sys.argv[1]+".png","w")
im.writePng(f)
f.close()
simple()