|
List Info
Thread: Banner
|
|
| Banner |

|
2006-08-27 19:32:35 |
|
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 |
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|