[Image-SIG] Palette fill on lines?

Deirdre Saoirse Moen deirdre@deirdre.net
Mon, 13 May 2002 13:01:06 -0700


At 2:37 PM -0500 5/13/02, Richard A. Smith wrote:
>On Mon, 13 May 2002 11:53:35 -0700, Deirdre Saoirse Moen wrote:
>
>>So, at the risk of sounding like a complete dolt, how do I specify a
>>colored line? Trying an RGB tuple didn't work for the fill parameter,
>>for example. setink on the prior line is soundly ignored.
>
>fill = (R,G,B) as an argument in the draw.line() method worked for
>me.  I'm using 1.1.2 though.

I'm using 1.1.3

The line in question is:
  lg.d.line((lg.xpoints[i], convertToY(lg, lg.indexhits[i]))
        + (lg.xpoints[i+1], convertToY(lg, lg.indexhits[i+1])), fill=(0,0,255))

fill works fine if it is an integer. The documentation says it can be 
either an integer or a tuple, but using a tuple as above gives this 
traceback:

Traceback (most recent call last):
   File "graph.py", line 163, in ?
     drawGraph(lg)
   File "graph.py", line 153, in drawGraph
     drawHits(lg)
   File "graph.py", line 146, in drawHits
     + (lg.xpoints[i+1], convertToY(lg, lg.indexhits[i+1])), fill=(0,0,255))
   File "/usr/lib/python2.1/site-packages/PIL/ImageDraw.py", line 113, in line
     ink, fill = self._getink(fill)
   File "/usr/lib/python2.1/site-packages/PIL/ImageDraw.py", line 77, in _getink
     ink = self.im.draw_ink(ink)
TypeError: an integer is required

Resulting image thus far can be seen at:
http://fuzzyorange.com/stats.gif
-- 
_Deirdre    Stash-o-Matic: http://fuzzyorange.com    http://deirdre.net
"I'm writing a book. I've got the page numbers done."   - Steven Wright