Re: [Image-SIG] remove an image background using PIL

2009-05-31 Thread Douglas Bagnall
Peter Yen 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 backgrou

Re: [Image-SIG] remove an image background using PIL

2009-05-31 Thread Fredrik Lundh
On Thu, May 28, 2009 at 10:53 PM, Peter Yen wrote: > Hi Fredrik, > > 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. > > imagick has method like f

Re: [Image-SIG] remove an image background using PIL

2009-05-31 Thread Laura & Edward Cannon
One way to get rid of a single color background is to get the background color (look at the upper left pixel) and then compare every pixel to it. If they are the same, make it transparent, otherwise leave it be. This obviously only works if nothing in the foreground is colored the same as the backg

Re: [Image-SIG] remove an image background using PIL

2009-05-28 Thread Fredrik Lundh
On Thu, May 28, 2009 at 10:22 PM, Peter Yen wrote: > Is there any sample code to use PIL to remove the image background and make > it transparent? Any help and advice is highly appreciated. Depends on what the background is. The further it is from "a single known color", the harder it gets. _

Re: [Image-SIG] remove an image background using PIL

2009-05-28 Thread Peter Yen
Hi Fredrik, 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. imagick has method like floodfill, curious how to do that with PIL. thanks a lot -peter

[Image-SIG] remove an image background using PIL

2009-05-28 Thread Peter Yen
Hi, Is there any sample code to use PIL to remove the image background and make it transparent? Any help and advice is highly appreciated. -peter ___ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig