[Image-SIG] Making the "outside" of an image transparent

Paul Moore p.f.moore at gmail.com
Wed May 10 23:46:32 CEST 2006


On 5/10/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> Paul Moore wrote:
>
> > So I can get transparency set, but I still don't know a good flood
> > fill algorithm.
>
> eric raymond posted a nice implementation last year, which will go
> into 1.1.6:
>
>     http://article.gmane.org/gmane.comp.python.image/1753
>
> (note that his code doesn't work on PIL Image objects; mapping this
> to corresponding PIL methods is left as an exercise etc etc)

That's the one I found, and based my code on. The problem I had was
that it floods everything until it hits a specific colour - whereas I
am looking to flood evertything of one colour, until I hit a different
colour.

It's almost the same, but something in the edge conditions went wrong, I think.

Actually, things were made worse by the fact that I was creating
images for a web page, and I hadn't realised that Internet Explorer
only seems to respect transparency in GIF files. (I was avoiding GIF,
as PIL doesn't compress them, for copyright reasons, as I understand
it). I'll go back and look again and see if I can get that algorithm
working.

Thanks,
Paul.


More information about the Image-SIG mailing list