[Image-SIG] Re: Hard to OCR Font

Marilyn Davis marilyn at deliberate.com
Sat Apr 17 17:34:55 EDT 2004


Hello again,

I'm once again begging for hints about this.  I've googled and googled.
It's been discussed on this list and someone provided a link to some
fonts in .pil, but the link is gone now.

So here I tried cursive.bdf from Tom's X11 fonts:

[root at maildance Images]# ../Scripts/bdf2pil.py cursive.bdf
BDF2PIL 1.0 -- Font compiler for X BDF fonts.
Copyright (c) Fredrik Lundh 1996.  All rights reserved.
cursive.bdf
# Fine;Cursive;Medium;Italic;Normal;;13;130;72;72;Cell;120;ISO8859;1
Traceback (most recent call last):
  File "../Scripts/bdf2pil.py", line 205, in ?
    image, srcbbox = font2image(font, ascent, descent)
  File "../Scripts/bdf2pil.py", line 155, in font2image
    d = Image.core.hex_decoder("1")
TypeError: function takes exactly 2 arguments (1 given)
[root at maildance Images]# 

Here I tried loading a truetype font:

[webedit at maildance cgi]$ !!
./stealth_image.py
Traceback (most recent call last):
  File "./stealth_image.py", line 112, in ?
    f,a = image_file()
  File "./stealth_image.py", line 83, in image_file
    im, pattern = gen_image()
  File "./stealth_image.py", line 61, in gen_image
    font = ImageFont.truetype('../images/toast.ttf',20)
  File "/usr/local/lib/python2.3/site-packages/PIL/ImageFont.py", line 189, in truetype
    return FreeTypeFont(filename, size, index)
  File "/usr/local/lib/python2.3/site-packages/PIL/ImageFont.py", line 117, in __init__
    self.font = _imagingft.getfont(file, size, index)
IOError: cannot load font

In this line:

    font = ImageFont.truetype('../images/toast.ttf',20)

I just invented the 20, hoping it would result in a big font.

Just hoping for a little help,

Marilyn Davis








More information about the Image-SIG mailing list