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

Re: [pygame] Saving Alpha Channels



On Sat, Oct 4, 2008 at 10:34 PM, Ian Mallett <geometrian@xxxxxxxxx> wrote:

> [snip]... the saved images do not have the
> alpha channel, which means that they don't have transparency which means
> that the textures don't work.
>
> Ideas?

Would something like PIL's putalpha do what you want? (provided you *have* PIL)
http://www.pythonware.com/library/pil/handbook/image.htm (search for putalpha)

import Image
my_image = Image.open('somefile.jpg')
my_image.put_alpha(0)
my_image.save('somefile.png')

This would convert all the black (int val for black = 0) in your image
to alpha's, but then you'd have to save to something that supports an
alpha channel.

-- 
brad [bradmontgomery.net]