Need help from someone that have PIL installed
__peter__ at web.de
Fri Aug 6 16:26:52 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
# the last tuple is the background color
img = Image.new("RGBA",(300, 50), (0, 0, 0, 0))
> draw = ImageDraw.Draw(img)
> arial = ImageFont.truetype("arial.ttf",32) # needs path to font, my font
> was in the same folder as the script
# I think that the PIL can cope with unicode, so add a u-prefix here:
text = u"proba test �����"
draw.text((20,8), text ,font=arial, fill="red")
> # write
> img.save("img2.png", "PNG")
More information about the Python-list