[Image-SIG] Problem choosing inks/drawing in GIF file
Manoj Plakal
plakal@cs.wisc.edu
Tue, 10 Jul 2001 05:53:43 -0500
Hi,
I'm trying to use PIL to draw a line
graph on a pre-existing GIF template file.
However, for some reason, no matter
what palette index I specify as
the ink, the lines I draw are all white
(which happens to be the first color
in the palette).
Could anyone see what I'm doing wrong?
Code is at the end of the message.
Also, I tried the example code on
creating paletted images from scratch
(http://www.pythonware.com/products/pil/articles/creating-palette-images.htm)
and all I get is a black rectangle,
none of the shapes specified in the
code are drawn.
This is with PIL-1.1.2, Python 2.1,
Solaris 2.8.
Thanks,
Manoj
------------------------------------------
import Image, ImageDraw
image = Image.open( "graph_template.gif" ) # -- 500x600 GIF, 67-color palette
draw = ImageDraw.Draw( image )
draw.setink(1) # -- Orange-ish
draw.line( [(52,550),(220,40)] )
draw.setink(2) # -- another shade of orange
draw.line( [(220,40),(300,550)] )
draw.ellipse( (52,40,300,550) )
image.save( "graph.gif" )
------------------------------------------