[Image-SIG] Re: ImageDraw not working

bas pels pels@bio.uva.nl
Wed, 01 Sep 1999 11:12:00 +0200


> I am looking at a simple example almost out of the book.
> 
> import Image, ImageDraw, ImagePalette
> 
> #im = Image.new('P',(300,200),100)
> im = Image.open("lena.jpg")
> draw = ImageDraw.Draw(im)
> pal = ImagePalette.ImagePalette
> draw.setink(128)
> 
> #print draw.ink
> #print draw.im
> 
> draw.line((0,0),im.size)
> 
> I get the following error.
> 
> Traceback (innermost last):
>   File "t.py", line 14, in ?
>     draw.line((0,0),im.size)
>   File "/usr/local/lib/python1.5/site-packages/PIL/ImageDraw.py", line
> 107, in line
>     ink, fill = self._getink(fill)
>   File "/usr/local/lib/python1.5/site-packages/PIL/ImageDraw.py", line
> 73, in _getink
>     ink = self.im.draw_ink(ink)
> TypeError: illegal argument type for built-in operation
> 


hi,
a couple of days ago i arrived at the same problem.
for one or another reason, the draw objects (line, rectangle etc)
now require a single tuple for the xy coordinates.

draw.line((0,0,im.size))     or
draw.line(((0,0),im.size))

should do the job.

ciao,
bas


......................................................................
bas pels
university of amsterdam
section population biology
kruislaan 320, 1098 sm amsterdam                  fax: +31 20 525 7754
the netherlands                                   tel: +31 20 525 7743