Korean/unicode strings in PIL

Joris Vankerschaver <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
Dear all,

I would like to use PIL to generate thumbnails with Korean characters.  
Unfortunately,  the code that I use doesn't produce the correct output.  
Here is a small snippet, based on some PIL example code.

code = u'\uAC00'
letter = code.encode('UTF-8')

i = Image.new("RGB", (25,25))
d = ImageDraw.Draw(i)
f = ImageFont.truetype("AppleMyungjo.ttf", 12, encoding = "unic")
d.text((0,0), letter, font = f)
i.save(open("ga.png", "wb"), "PNG")

Here, "AppleMyungjo.ttf" is a font that has some Korean characters in 
it.  The program doesn't produce any errors, but the output image just 
contains garbage pixels (different ones based on the font I pick, but 
never the correct ones).  I've tried playing with the different options, 
but to no avail.  To see what the output should look like, simply do 
"print u'\uAC00'.encode('UTF-8')".

Does anyone have some sample code to produce 
Korean/Japanese/Chinese/random unicode text in images?

I'm afraid this might be a trivial problem, but the obvious google 
searches didn't yield anything useful.

Thanks a lot,
Joris Vankerschaver.
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.