-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
What did you do?
The behavior of ImageDraw.polygon changed between versions 8.0.4 and 9.0.0 if the polygon is a line.
Could it be related to #5694?
import PIL
import PIL.ImageDraw
import numpy as np
line_vertices = [(1, 0), (1, 0), (2, 0), (2, 0)]
img = PIL.Image.new("L", (6, 5), 0)
PIL.ImageDraw.Draw(img).polygon(line_vertices, outline=1, fill=1)
result = np.array(img).astype(bool)What did you expect to happen?
This was the result with Pillow 8.0.4
array([[False, False, False, False, False, False],
[False, False, False, False, False, False],
[False, False, False, False, False, False],
[False, False, False, False, False, False],
[False, False, False, False, False, False]])What actually happened?
This is the result with Pillow >= 9.0.0
array([[False, True, True, False, False, False],
[False, False, False, False, False, False],
[False, False, False, False, False, False],
[False, False, False, False, False, False],
[False, False, False, False, False, False]])What are your OS, Python and Pillow versions?
- OS: macOS 12.13.1
- Python: 3.9.7
- Pillow: 8.0.4 and >= 9.0.0
Reactions are currently unavailable