-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
floodfill wraps around #4016
Copy link
Copy link
Closed
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.
Description
The ImageDraw.floodfill code assumes a negative index will raise an IndexError, but python wraps that around to the last element, which is not the desired effect. This causes a floodfill that hits the left side or the top of the image to wrap around to the other side. Code:
try:
p = pixel[s, t]
except (ValueError, IndexError):
pass
else:Fix:
try:
if s < 0 or t < 0:
raise IndexError
p = pixel[s, t]
except (ValueError, IndexError):
pass
else:Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.