Need help from someone that have PIL installed

alejandro aleksandar27 at BRISIOVOnet.hr
Fri Aug 6 15:58:02 CEST 2010


Can please someone run this little script that should output characters like 
¾æè¹ð in an image.
If it does it correctly can you tell me what OS, python version & PIL 
version you have?
Or better if someone can tell me why this is not working properly on my PC? 
(Win XP, PIL 1.1.6., Python 2.6...)
I don't recive any error it's just that the characters outputed in the image 
are not characters... more like symbols...

# encoding:utf-8

from PIL import Image
import ImageDraw
import ImageFont


img = Image.new("RGBA",(250,40))

#----------------------------------- making the image transparent
pixdata = img.load()

for y in xrange(img.size[1]):
    for x in xrange(img.size[0]):
        if pixdata[x, y] == (255, 255, 255, 255):
            pixdata[x, y] = (255, 255, 255, 0)

#--------------------------------- drawing text
draw = ImageDraw.Draw(img)
arial = ImageFont.truetype("arial.ttf",32)  # needs path to font, my font 
was in the same folder as the script
string = "proba test ¾æèð¹"
draw.text((20,8),string ,font=arial, fill="red")

# write
img.save("img2.png", "PNG")





More information about the Python-list mailing list