In the Windows Paint application, you can fill a certain part of the image a specific color (using the bucket icon). Is there a way to do this with PIL? I've searched the API, but I can't seem to find a way to do this. I figure I could go check pixel by pixel, but I wanted to avoid this if the functionality already exists.
Asked
Active
Viewed 225 times
0
-
Other than `floodfill()`? – Ignacio Vazquez-Abrams Jul 17 '16 at 12:12
-
@IgnacioVazquez-Abrams I tried looking for [that in the search](https://pillow.readthedocs.io/en/3.3.x/search.html?q=floodfill&check_keywords=yes&area=default#) but nothing came up. – But I'm Not A Wrapper Class Jul 17 '16 at 12:15
-
Apparently `floodfill()` isn't documented. You should have also searched [here](http://stackoverflow.com/search?q=[python]+PIL+area+fill) before posting your question. – martineau Jul 17 '16 at 12:21
-
@martineau I did, but I couldn't find documentation on floodfill. I didn't know *exactly* what it was doing (for example, is it lazy such that I have to reload the image again). – But I'm Not A Wrapper Class Jul 17 '16 at 12:28
-
As I said, the reason you couldn't find any documentation is because there isn't any—although if you _read_ the [accepted answer](http://stackoverflow.com/a/10027354/355230) to the duplicate question apparently there's a little bit available from `help(ImageDraw.floodfill)`. As for whether it's "lazy" or not, seems like you could just try it and see. Lastly, if all else fails, you can read the source code and find out exactly what it does. – martineau Jul 17 '16 at 13:04