Hi all,
I just profiled a little my banner.py.
# PIL_Banner
import Image, ImageFont, ImageDraw
ShowText = 'Python :)'
font = ImageFont.load(r'courier-bold-12.pil')
size = font.getsize(ShowText)
image = Image.new('1', size, 1)
draw = ImageDraw.Draw(image)
draw.text((0, 0), ShowText, font=font)
for rownum in range(size[1]):
line = []
for colnum in range(size[0]):
if image.getpixel((colnum, rownum)): line.append(' '),
else: line.append('#'),
print ''.join(line)
#image.show()
I have just recognized that, the pil font files are missing from the PIL distribution, so I have atteched a pil font, that has to be placed beside the script.
So, it will create the next response:
### #
###### ## ## ##
## ## ## ## ##
## ###### ######### ## ## #### ## ### ## ##
## ## ## ## ## ### ## ## ## ### ## ## ##
##### ## # ## ## ## ## ## ## ## ##
## #### ## ## ## ## ## ## ## ##
## ### ## # ## ## ## ## ## ## ## ##
##### ## ### ### ### #### #### ## ## ##
## ##
## #
####
Yours sincerely,
Janos Juhasz
courier-bold-12.png
Description: Binary data
courier-bold-12.pil
Description: Binary data
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor