ChrisG
ChrisG

Reputation: 343

Small circle (6x6px) is rendered asymmetrically

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.enter image description here

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

Answers (2)

ChrisG
ChrisG

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

Jasper
Jasper

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

Related Questions