[Image-SIG] ImageFont problems
Fri, 15 May 1998 07:26:43 +0000
I've just started using the ImageFont facility of PIL, and have run
into a 'bug' in the cropping code (Crop.c) of libImaging. I narrowed the
problem down to a general problem with cropping to:
>>> import Image
>>> im = Image.new('1',(800,9))
Traceback (innermost last):
File "<stdin>", line 1, in ?
SystemError: NULL result without error in call_object
Basically, I had to change the code in Crop.c to:
/* Determine which region to copy */
xoff = yoff = 0;
if (x0 < 0)
xsize += x0, xoff = -x0, x0 = 0;
if (xsize > imOut->xsize)
xsize = imOut->xsize;
if (y0 < 0)
ysize += y0, yoff = -y0, y0 = 0;
if (ysize > imOut->ysize)
ysize = imOut->ysize;
Now, that seems to work - it doesn't generate a SystemError any more.
The xoff and yoff values don't seem to be used anyway. What should the
behaviour be if out of bounds values are passed to crop()?
But then I try:
>>> import Image, ImageDraw, ImageFont
>>> d.text((10,10), 'hello world')
and I get a blank image. I I go further and try:
>>> f.getmask('hello world').show()
I get the text. What am I doing wrong?
Richard Jones, Satellite Section at the Bureau of Meteorology, Australia.
Work phone: +61-3-9669-4539