[Image-SIG] PIL Bug report and performance problem

Barry Scott tsbarry@nortelnetworks.com
Fri, 5 Feb 1999 13:16:45 -0000


/F,
	Opss... a draft of this message escaped before I finished
	it off, sorry.

	Bug report
	----------

	bdf2pil.py does not work. Python reports:

$ python ../tmp/Imaging-1.0b1/Scripts/bdf2pil.py courR10.bdf
BDF2PIL 1.0 -- Font compiler for X BDF fonts.
Copyright (c) Fredrik Lundh 1996.  All rights reserved.
courR10.bdf
# Adobe;Courier;Medium;Roman;Normal;;10;100;75;75;Monospaced;60;ISO8859;1
Traceback (innermost last):
  File "../tmp/Imaging-1.0b1/Scripts/bdf2pil.py", line 205, in ?
    image, srcbbox = font2image(font, ascent, descent)
  File "../tmp/Imaging-1.0b1/Scripts/bdf2pil.py", line 155, in font2image
    d = Image.core.hex_decoder("1")
TypeError: function requires exactly 2 arguments; 1 given

	This fix seems to work.

155c155
<           d = Image.core.hex_decoder("1")
---
>           d = Image.core.hex_decoder("1","1")         # BAS	

	Performance problem in Image font
	---------------------------------

	I'm using PIL to create a GIF image with some text on it.

	The ImageFont code is taking up lots of time to do its work.

	I have started to optiomize ImageFont and hope contribute
	a speed up soon. The two things I noticed where:

	It read the font description using 256 reads of 20 bytes.
	Using 1 read of 20*256 gets a 5% speed up.

	The other thing that I'm still trying is to use struct rather
	them i16 and the lambda loop. (I made the change but python
	use up all available memory and raise a memory exception. This
	is under FreeBSD and I'm going to investigate this weekend.)

	Hopefully you can include the speed up the release 1.0.

		Barry
p.s.
> -- color fixes in ImageDraw.text
>     (hmm. forgot who reported this).

	That was me.