PIL - setting the width of lines in ImageDraw

Larry Bates lbates at swamisoft.com
Mon Sep 13 16:07:04 EDT 2004


When you want lines wider than 1px you are actually
drawing rectangles with fillcolor set to the line
color.  There is a drawrectangle method.

You should also take a look at www.reportlab.com
(the ReportLab Graphics module is great).  I use
it to do almost all my graphing from Python.

Larry Bates
Syscon, Inc.

"Max M" <maxm at mxm.dk> wrote in message
news:4145fc21$0$273$edfadb0f at dread12.news.tele.dk...
> I am using PIL to generate som graphs, like:
>
> draw = ImageDraw.Draw(im)
> for graph in self.graphs:
>      polygon = graph.getPolygon()
>      draw.polygon(polygon, outline=graph.color)
> del draw
>
> But the linewidth of my polygon is only one pixel wide. Is there any way
> to set it to something else?
>
> (How nice it would be to have css compatible parameters on polygons,
> like: draw.polygon(polygon, border="1px solid gray"))
>
> I have read the docs, and browsed the source. But me being a lowly
> Windows developer I stopped at _imaging.py module, which the ImageDraw
> module apparantly use to do the actual drawing.
>
>
> regards Max M





More information about the Python-list mailing list