[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] How do I make a image transparent?



Thanks I'll keep that in mind :).

On 9/11/07, Ian Mallett <geometrian@xxxxxxxxx> wrote:
On 9/11/07, Lamonte Harris <pyth0nc0d3r@xxxxxxxxx > wrote:
Tell me what you think: http://cleanscript.com/Map/main3.py


On 9/11/07, Lamonte Harris < pyth0nc0d3r@xxxxxxxxx> wrote:
Thanks :) works like a charm :P.

On 9/11/07, Luke Paireepinart <rabidpoobear@xxxxxxxxx > wrote:
Lamonte Harris wrote:
> See I got this png file w/ a white BG :( is it possible to make the
> white in the BG of the image transparent?
Of course - look into the setcolorkey method of surfaces.  You'd just
set the color key to white.
255 blue is more common as a colorkey, since white is much more common
as a color, but it will work just fine in this case since there's no
white in the sprites themselves, just in the backgrounds.

Fluorescent green works too. 
I realize your problem has been solved, but if you want to make your code a bit smaller, you could do the colorkey thing with a paint program and save to alpha channel.  Call with ' pygame.image.load("file").convert_alpha()'.
Ian