--- Luc Tonin <[EMAIL PROTECTED]> wrote:
> well
> i m still trying to insert some text in a gif image
> using PIL
> but what should i do??? using da PSDraw class??
> does anybody have an id ??
> thx by advance

I recently got that working for me by doing a few
tricky things:

created a directory in Extensions called "BDF" and put
the font files (courR14.pil an courR14.pbm) in there.
(make sure that dir is zope readable)

then add ImageFont to your PIL init script. (kind of
like the file replacement in ZPhoto does)

then in your external method and the import statement
for the fonts. (in mine I did "import PIL.ImageFont")

and then I experimented around and got the following
code to setup the font stuff:

wd = os.environ['PYTHONHOME']
wd_ext = wd + '/Extensions'
wd_ext_bdf = wd_ext + '/BDF'
sys.path[:0] = [wd_ext]                 # prepend the font path
sys.path[:0] = [wd_ext_bdf]
font = PIL.ImageFont.load_path("courR14.pil")

I put this in the global part of the external method
and the rest of the methods could use fonts.

(for some reason I couldn't get any other font to
work. courR14 is the default in the PIL library.  to
fonts you can simply save another font as the courR14

After that you can use fonts in your methods with:

draw = PIL.ImageDraw.Draw(image)
draw.text((x,y),"text to print")

Hope this helps.

I will *hopefully* be releasing a zope product in the
near future that uses PIL fonts so you can use it as
an example.  Right now I'm ironing it out a little,
but keep an eye out for it.  I think I'm going to call
it "NetMap"


Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to