tags:

views:

84

answers:

1

I've tried lots of solution that posted on the net, they don't work.

>>> import _imaging
>>> _imaging.__file__
'C:\\python26\\lib\\site-packages\\PIL\\_imaging.pyd'
>>>

So the system can find the _imaging but still can't use truetype font

from PIL import Image, ImageDraw, ImageFilter, ImageFont


im = Image.new('RGB', (300,300), 'white')
draw = ImageDraw.Draw(im)
font = ImageFont.truetype('arial.ttf', 14)
draw.text((100,100), 'test text', font = font)

ImportError: The _imagingft C module is not installed

File "D:\Python26\Lib\site-packages\PIL\ImageFont.py", line 34, in getattr raise ImportError("The _imagingft C module is not installed")

+2  A: 

Your installed PIL was compiled without libfreetype.

You can get precompiled installer of PIL (compiled with libfreetype) here (and many other precompiled Python C Modules)

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Imran
Would it work on Linux? I saw only .exe files:<
If you want linux binaries you'll have to get it from your distro's software repository I guess.
Imran
This was exactly what I needed to get TTF support on Windows. The PIL binaries on the official page were having sxs issues when loading _imagingft.pyd. Thanks!
sludge