-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
When using the line method of a Draw object on a newly created image to draw vertical lines, all lines drawn with more than 1 pixel width are one pixel widther (a 2 pixels width line is drawn with a 3 pixels width).
How to reproduce the problem:
This "proof of concept" program reproduces the problem creating a 10x10 image with a centered cross of two lines 2 pixels width, one horizontal and one vertical, where the vertical one is clearly widther than the horizontal.
from PIL import Image, ImageDraw
img = Image.new('RGB', (10, 10), (255, 255, 255))
draw = ImageDraw.Draw(img)
draw.line((0, 5, 10, 5), (0, 0, 0), 2)
draw.line((5, 0, 5, 10), (0, 0, 0), 2)
img.save("test-bad-lines.png", 'PNG')Expected result:
A cross of two lines, both with the same width, 2 pixels.
Current result:
A cross with the horizontal line 2 pixels width and the vertical line 3 pixels width.
Additional information:
This bug only happens when drawing vertical lines with at least two pixels width.
1 pixel width vertical lines and horizontal lines of any width doesn't seem to have this problem.