Comment 9 for bug 540460

Andreas Bittel (andreas-bittel) wrote :

Hello all,

I have also a problem with "ImportError: The _imagingft C module is not installed". I installed python 2.6.4 and the corresponding
PIL-1.1.7.win32-py2.6.exe. My script is the following:

from PIL import Image, ImageDraw, ImageFont

im =Image.new("RGB",(400,400),(128,0,0))

draw = ImageDraw.Draw(im)
draw.line((0, 0) + im.size, fill=(128,128,128))
draw.line((0, im.size[1], im.size[0], 0), fill=128)

# use a bitmap font
font = ImageFont.truetype("arial.ttf",15)
#font =ImageFont.load("courB12.pil")

draw.text((10,20), "Test", font=font)
del draw

# write to stdout
im.save("c:\Test.bmp", "bmp")

Traceback (most recent call last):
  File "\\cdn-srv8\CDN_userbase$\andreas.bittel\Eigene Dateien\Downloads\Image_Test.py", line 11, in <module>
    font = ImageFont.truetype("arial.ttf",15)
  File "C:\Python26\lib\site-packages\PIL\ImageFont.py", line 218, in truetype
    return FreeTypeFont(filename, size, index, encoding)
  File "C:\Python26\lib\site-packages\PIL\ImageFont.py", line 134, in __init__
    self.font = core.getfont(file, size, index, encoding)
  File "C:\Python26\lib\site-packages\PIL\ImageFont.py", line 34, in __getattr__
    raise ImportError("The _imagingft C module is not installed")
ImportError: The _imagingft C module is not installed

What do I have to do to use the text output in an image?