[Image-SIG] Convert RGB to RGBA

Angelo angelol at easyconnect.fr
Sat Aug 19 00:55:26 CEST 2006


On ven, 2006-08-18 at 19:27 +0200, Fredrik Lundh wrote:

> the alpha layer controls transparency, and doesn't have any direct 
> relation to the RGB values.  to add an alpha layer to an image, you can 
> use a direct convert:
> 
> 	imOut = im.convert("RGBA") # sets alpha to 255
> 
> if you have an RGB image, you can also modify it in place
> 
> 	im.putalpha(value) # set alpha to given value
> 
> or
> 
> 	im.putalpha(matte) # where matte is a mode "L" image
> 
> </F>

Thanks Fredrik ! .

That is what I would like to make : I have numerous blue pixels with the
RGB value - > (36, 103, 210) and I would like to return the totally
transparent image only where there are pixels with this value (36, 103,
210) . It is possible (?) and if yes how can it be done ? .
I apologize if my demand seems stupid (also for my bad english), but I
have no experience with PIL .

a+



More information about the Image-SIG mailing list