Skip to content Skip to sidebar Skip to footer

Python PIL - Draw Circle

I am trying to draw a simple circle and save this to a file using the Python Imaging Library: import Image, ImageDraw image = Image.new('RGBA', (200, 200)) draw = ImageDraw.Draw(i

Solution 1:

Instead of specifying the upper right and lower left coordinates, swap them to get the upper left and lower right.

draw.ellipse((20, 20, 180, 180), fill = 'blue', outline ='blue')

Solution 2:

Your ellipsis coordinates are incorrect, that should be (x1, y1, x2, y2), where x1 <= x2 and y1 <= y2, as those pairs, (x1, y1) and (x2, y2), represents respectively top left and bottom right corners of enclosing rectangle.

Try to change to

draw.ellipse((20, 20, 180, 180), fill = 'blue', outline ='blue')

enter image description here


Post a Comment for "Python PIL - Draw Circle"