fonts in PIL ?
Cousin Stanley
CousinStanley at hotmail.com
Mon Feb 9 11:10:17 EST 2004
| ....
| Also, are there some real examples of use of fonts in PIL ?
| ....
Stéphanie ....
Following is an example of using the PIL ImageFont class ....
'''
Module ....... pil_ImageFont.py
Code_By ...... Stanley C. Kitching
Code_Date .... 2004-02-09
'''
import Image
import ImageFont
import ImageDraw
this_list = [ " Look, up in the sky ......... " ,
" It's a bird ................ " ,
" It's a plane ............... " ,
" It's S u p e r M a n !!!!! " ,
" " ,
" More powerful" ,
" than a locomotive !!!!!!" ,
" " ,
" Able to leap tall buildings" ,
" in a single bound !!!!!!" ]
this_image = Image.new( 'RGB' , ( 360 , 240 ) )
# Adjust dir_PIL path to YOUR installation
dir_PIL = 'K:/Python23/Lib/site-packages/PIL/'
dir_fonts = dir_PIL + 'pilfonts/'
this_font = 'courB12.pil'
i_font = ImageFont.load( dir_fonts + this_font )
this_col = 10
this_row = 10
row_inc = 20
for this_line in this_list :
i_draw = ImageDraw.Draw( this_image )
i_draw.text( ( this_col , this_row ) , this_line , font = i_font )
this_row += row_inc
this_image.save( 'pil_ImageFont.png' )
this_image.show()
--
Cousin Stanley
Human Being
Phoenix, Arizona
More information about the Python-list
mailing list