Reputation: 343
I have a problem drawing symmetric circles with the Python Imaging Library. The following code should create a circle with a diameter of 6 px. What it draws is a unsymmetric "circle" shown in die picture. Does anybody has a solution? This problem occurs for all evan diameters.
from PIL import Image, ImageDraw
img = Image.new('1', (8, 8), "white")
draw = ImageDraw.Draw(img)
draw.ellipse((1, 1, 6, 6), fill = 'black', outline ='black')
img.show()
Upvotes: 0
Views: 78
Reputation: 343
The code is right. Thats a Bug in the Pillow Package. It should be fixed with the next update (3.3.0) on first of July.
Upvotes: 0
Reputation: 3947
I guess that's because drawing circles is hard and your result is what the algorithm used by PIL produces for such small circles. You could draw your own "circle" using a polygon.
One could argue however that ellipses with equal radii should at least be symmetric...
Upvotes: 3