[Image-SIG] Here's a better flood-fill technique

Fredrik Lundh fredrik at pythonware.com
Wed Sep 21 12:41:36 CEST 2005


Eric S. Raymond wrote:

> This is nonrecursive and the storage requirement is bounded by the
> number of pixels in the region perimeter.  Each pixel will be accessed
> at most three times and set just once.  It's simple and efficient.
> Even, dare I say it, elegant.

worklist-based algorithms are often simple and elegant, and this is of
course no exception.

> Frederik, say the word and I'll ship you a generalized version for PIL.

no need; this looks like a nice addition to 1.1.6, and I can take it from
here...

thanks! /F 





More information about the Image-SIG mailing list