-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected, additional outline in ImageDraw.ellipse, even for outline=None #4277
Comments
Making 'opaque outlines' and 'semi-transparent outlines' behave the same as 'no outlines' specified is easy enough - def ellipse(self, xy, fill=None, outline=None, width=0):
"""Draw an ellipse."""
ink, fill = self._getink(outline, fill)
if fill is not None:
self.draw.draw_ellipse(xy, fill, 1)
- if ink is not None and ink != fill:
+ if ink is not None and ink != fill and width != 0:
self.draw.draw_ellipse(xy, ink, 0, width) However, 'no outlines' may be more difficult, as it is sort of a known problem - Lines 445 to 446 in aa2c5f9
If you're interested in a workaround, you could draw the ellipse without an alpha value, and then paste it with an alpha value. |
I have created PR #4333 and #4334. #4333 will remove the darker outline using the fill colour, and #4334 will stop the application of the specified outline colour for a zero width. Could I clarify - you have no problem with the behaviour of |
@radarhere Correct, |
What did you do?
Drawing a polygon using
ImageDraw.polygon
and an ellipse usingImageDraw.ellipse
with no outline specified, with an opaque outline, and with a semi-transparent outline.What did you expect to happen?
ImageDraw.polygon
andImageDraw.ellipse
should behave the same for the mentioned cases.What actually happened?
The output created by the code below:
Looking at the polygon, if no outline is specified (top left image), we see that the black line is visible, which is one of the polygon's borders. Specifying an opaque outline (top center image), the black line's no longer visible. Setting a semi-transparent outline (top right image) reveals, that the outline is identical to the polygon's border.
Now, the same for the ellipse: If no outline is set (top left), an outline is shown nevertheless, most likely the same color as used for the
fill
parameter, but without incorporating an alpha value. Setting an opaque outline (top center) "overwrites" the unexpected existent outline, but when setting a semi-transparent outline, we see that the unexpected outline is still there.This effect becomes even more obvious, when setting
width > 1
inellipse
, see the bottom row. The unexpected outline still seems to havewidth = 1
, whereas the explicitly set outline haswidth = 5
.What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: