diff --git a/src/PIL/ImageDraw.py b/src/PIL/ImageDraw.py index 9b0864d1a89..66511697a93 100644 --- a/src/PIL/ImageDraw.py +++ b/src/PIL/ImageDraw.py @@ -175,7 +175,7 @@ def arc( ) -> None: """Draw an arc.""" ink, fill = self._getink(fill) - if ink is not None: + if ink is not None and width != 0: self.draw.draw_arc(xy, start, end, ink, width) def bitmap( @@ -235,12 +235,12 @@ def line( self, xy: Coords, fill: _Ink | None = None, - width: int = 0, + width: int = 1, joint: str | None = None, ) -> None: """Draw a line, or a connected sequence of line segments.""" ink = self._getink(fill)[0] - if ink is not None: + if ink is not None and width != 0: self.draw.draw_lines(xy, ink, width) if joint == "curve" and width > 4: points: Sequence[Sequence[float]] diff --git a/src/_imaging.c b/src/_imaging.c index 980f827ae78..7fee411149c 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -3172,8 +3172,8 @@ _draw_lines(ImagingDrawObject *self, PyObject *args) { PyObject *data; int ink; - int width = 0; - if (!PyArg_ParseTuple(args, "Oi|i", &data, &ink, &width)) { + int width; + if (!PyArg_ParseTuple(args, "Oii", &data, &ink, &width)) { return NULL; } @@ -3182,7 +3182,7 @@ _draw_lines(ImagingDrawObject *self, PyObject *args) { return NULL; } - if (width <= 1) { + if (width == 1) { double *p = NULL; for (i = 0; i < n - 1; i++) { p = &xy[i + i];