Description
What did you do?
Drew a polygon with PIL's Image and ImageDraw modules
What did you expect to happen?
The Polygon should look consistent without holes in the middle
What actually happened?
There are holes and gaps.
What are your OS, Python and Pillow versions?
- OS: Ubuntu 22.04.5 LTS
- Python: Python 3.10.12
- Pillow: 11.0.0
Pillow 11.0.0
Python 3.10.12 (main, Nov 6 2024, 20:22:13) [GCC 11.4.0]
--------------------------------------------------------------------
Python executable is /home/ghrunner/venv/bin/python3
Environment Python files loaded from /home/ghrunner/venv
System Python files loaded from /usr
--------------------------------------------------------------------
Python Pillow modules loaded from /home/ghrunner/venv/lib/python3.10/site-packages/PIL
Binary Pillow modules loaded from /home/ghrunner/venv/lib/python3.10/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 11.0.0
*** TKINTER support not installed
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.4.0
--- JPEG support ok, compiled for libjpeg-turbo 3.0.4
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.2.11
--- LIBTIFF support ok, loaded 4.6.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.8, harfbuzz 10.0.1
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
Code to reproduce the issue along with the images:
from PIL import Image, ImageDraw
import matplotlib.pyplot as plt
shape = (35, 15)
pts = [(31, 12), (30, 12), (28, 11), (28, 10), (26, 7), (23, 7), (22, 8), (22, 13), (22, 13), (21, 13), (20, 14), (18, 14), (17, 13), (15, 13), (13, 11), (10, 11), (8, 13), (5, 13), (4, 12), (3, 12), (1, 10), (1, 8), (3, 5), (4, 6), (5, 6), (6, 7), (6, 8), (8, 10), (9, 10), (10, 10), (10, 4), (13, 0), (19, 0), (21, 2), (21, 3), (22, 4), (23, 3), (24, 3), (26, 6), (26, 7), (31, 12)]
img = Image.new("L", shape, 0)
draw = ImageDraw.Draw(img)
draw.polygon(pts, fill=255)
img.save('polygon.png')
x, y = zip(*pts)
plt.figure(figsize=shape)
plt.plot(x, y, marker='o', linestyle='-', color='blue', markersize=5, label='Points and Lines')
plt.scatter(x, y, color='red', zorder=5, label='Points')
plt.title("Visualization of Points with Connections")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.grid(True)
plt.legend()
plt.savefig('points.png')
Metadata
Metadata
Assignees
Labels
No labels