Need help from someone that have PIL installed
Peter Otten
__peter__ at web.de
Fri Aug 6 11:44:05 EDT 2010
alejandro wrote:
>> Make sure that
>>
>> # encoding:utf-8
>>
>> is the first line of your script, details and fineprint here:
>>
>> http://www.python.org/dev/peps/pep-0263/
>>
>> Peter
>
> Tryed that...
What happened?
> What was the output of my script on your computer?
$ python -V
Python 2.6.4
$ python -c "import Image; print Image.VERSION"
1.1.6
$ cat draw_text.py
# encoding:utf-8
from PIL import Image
import ImageDraw
import ImageFont
img = Image.new("RGBA",(300, 50), (0, 0, 0, 0))
draw = ImageDraw.Draw(img)
FONT = "/usr/share/fonts/truetype/msttcorefonts/arial.ttf"
arial = ImageFont.truetype(FONT, 32)
text = u"proba test ¾æèð¹"
print repr(text)
draw.text((20,8), text, font=arial, fill="red")
img.save("tmp.png")
$ python draw_text.py
u'proba test \xbe\xe6\xe8\xf0\xb9'
The image looks as expected.
Peter
More information about the Python-list
mailing list