[Image-SIG] PIL 1.1.5 polygon filling off by one vertical pixel, alpha blended drawing?

Fredrik Lundh fredrik at pythonware.com
Thu May 26 08:54:08 CEST 2005

"LML" wrote:

> the ImageDraw.Draw.polygon function does not draw as I expect it.
> Deep down in the C-code some Floor, Ceil and +0.5 seem to combine
> for a strange effect.

can you elaborate: from a quick look, the image seems to match
the code pretty well.

> 1. Any suggestions to actually draw within the outline only?
> 2. Why can't I draw with alpha-blending (it seems like I
>     have to im.paste to achieve this -- so inefficient...)

recent versions support RGBA-on-RGB drawing; from the CHANGES

    + Added experimental RGBA-on-RGB drawing support.  To use RGBA
      colours on an RGB image, pass "RGBA" as the second string to
      the ImageDraw.Draw constructor.

> 3. Do I have to destruct the Draw instance with del explicitly
>     (like it's done in the example code)
>     or is the implicit destruction enough to get it freed?

no.  normal garbage collection works here.

> 4. Is ImagePath.Path more efficient or just syntactic sugar?

Path is more efficient if you need to scale/transform the data before
you draw.  If you're doing the calculations elsewhere, you can use
any input format.


More information about the Image-SIG mailing list