Hello, everyone:

I have been really struggling with a PIL issue, and I'm hoping someone else
has experienced the behavior I am seeing.

My goal is to use ImageDraw().polygon to produce _only_ the filling, and to
draw the border of the polygon in either transparent or in the background
color.

When I attempt to do this, an odd extra line of pixels appears outside the
boundary.

The code below draws a simple polygon with a white border and black fill,
which works as expected.

The second code draws the same polygon with a black border and a white fill.
my expected result is to get a white triangle that 'fits inside'
the first one. It almost works, but there is an extra line of pixels along
the upper-right border.

The resulting pictures are attached.

Here is my code:

from PIL import Image,ImageDraw

if __name__=='__main__':
i = Image.new('L',(50,50), 0 );
ImageDraw.Draw(i).polygon([(10,10),(20,20),(10,20) ],outline=255, fill=0);
i.save("c:\\temp\\freak1.bmp",format="bmp");
 i = Image.new('L',(50,50), 0 );
ImageDraw.Draw(i).polygon([(10,10),(20,20),(10,20) ],outline=0, fill=255);
i.save("c:\\temp\\freak2.bmp",format="bmp");

Can anyone help me understand what i'm doing wrong?
Python 2.6.6, Windows, PIL version 1.1.7

<<attachment: freak2.bmp>>

<<attachment: freak1.bmp>>

_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to