List Info

Thread: banners




banners
user name
2006-08-26 20:04:47
I have continued to work on making banners

Here is a solution with PIL 
(http
://www.pythonware.com/products/pil/index.htm):


import Image, ImageFont, ImageDraw

ShowText = 'Hi all'

font = ImageFont.load(r'c:\Python24\Lib\site-
packages\enthought\kiva\pil_fonts\courier-bold-10.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]):
    for colnum in range(size[0]):
        if image.getpixel((colnum, rownum)): print "
",
        else: print "#",
    print ''

If your pil font file is in a different directory, you have
to change it.

It produces the next output for me anyway:

                                                    
                                                            
           
                # #                               # # #     
 # # #     
# #   # #                                           # #     
   # #     
# #   # #     # # #                   # # #         # #     
   # #     
# # # # #       # #                 # #   # #       # #     
   # #     
# #   # #       # #                   # # # #       # #     
   # #     
# #   # #       # #                 # #   # #       # #     
   # #     
# #   # #   # # # # # #             # # # # # # # # # # # #
# # # # # # 


                                                           
Janos Juhasz

____________________________________________________________
__________
Adómegtakarítás augusztusban? Ne dobja ki pénzét
feleslegesen!
http://
www.klikkbank.hu/befektetes/index.html

_______________________________________________
Tutor maillist  -  Tutorpython.org
http://
mail.python.org/mailman/listinfo/tutor
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )