[Tutor] Banner

János Juhász janos.juhasz at VELUX.com
Sun Aug 27 21:32:35 CEST 2006


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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060827/e146663a/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: courier-bold-12.png
Type: application/octet-stream
Size: 1370 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20060827/e146663a/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: courier-bold-12.pil
Type: application/octet-stream
Size: 5143 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20060827/e146663a/attachment-0001.obj 


More information about the Tutor mailing list