[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Saving Alpha Channels
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Saving Alpha Channels
- From: "Brad Montgomery" <brad@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 4 Oct 2008 22:51:10 -0500
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sat, 04 Oct 2008 23:51:16 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=jTYfdhZdmu5z09rgxVDhUwMho8lYdyqaKxqgNXVYwOA=; b=rTrABLS72DhJ8wfFWxkBSA/EzED8Hv1fqdRvWTs57+3Yqd6p6pPdW65jQiiKD5tYUY g0IsCJy5eH/ZXFTVIKsdvAwLcKYPf7s8ARcKdY+F+wYYiuH7XAnQ+rXu5yTzenSsL2f9 uRJd+7QjXMWJnhhkR3liMY78B3QTTGI6TLZgw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=V++nA8i3if6ScHP8nCNo93vgt4ouGyT2IAMjG+TUADwcnxYlyQHYm11CF+CE58yhoh SYihQB0S4R4dNvt/1KtjwhiEVO/sWusODO0enGoeAZ9vN8NyYiWUk19zWtbYvAoaaEIW AyuHNSpbZ8CrTHzShGnkGjGxorsdCtLifTmAU=
- In-reply-to: <a62fab400810042034o38a877dbx555133cdb552b0d0@xxxxxxxxxxxxxx>
- References: <a62fab400810042034o38a877dbx555133cdb552b0d0@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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]