[Image-SIG] remove an image background using PIL

Douglas Bagnall douglas at paradise.net.nz
Mon Jun 1 02:23:18 CEST 2009

Peter Yen <colorpyen at gmail.com> wrote:

>> Thanks for your quick response. The background is unknown at the time of
>> processing. Actually I don't need a very accurate methodology to remove all
>> background, removing partially is good enough.

I once wrote a (GPL'd) C module that fairly reliably extracts the
background of a photograph of a drawing on paper.  It is essentially the
same as PIL's floodfill but it follows shallow gradients.

The public git browser[1] seems to be broken right now, but if this
sounds like what you need download a tarball[2], and look for the
expand_region function in the img-c directory.

[1] https://savannah.nongnu.org/git/?group=tetuhi
[2] http://sourceforge.net/project/showfiles.php?group_id=217385


More information about the Image-SIG mailing list