← Back to team overview

phatch-dev team mailing list archive

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

 

Hi Nadia,
This made me think it would be a nice addition to the "colour to
alpha" to provide a "Select" parameter which has the options:
- By colour (behaviour as it is now)
- Top Left
- Top Right
- Bottom Left
- Bottom Right
This makes the action more flexible for batch processing images with
different colours.
What do you think?
Stani

---------- Forwarded message ----------
From: Laura & Edward Cannon <cannon.el@xxxxxxxxx>
Date: Fri, May 29, 2009 at 5:03 PM
Subject: Re: [Image-SIG] remove an image background using PIL
To: image-sig@xxxxxxxxxx


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 background, but I have had good success with
this sort of method in the pygame world for making sprites.



Follow ups