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

Re: [pygame] Saving Alpha Channels



On Sat, Oct 4, 2008 at 8:51 PM, Brad Montgomery <brad@xxxxxxxxxxxxxxxxxx> wrote:
Would something like PIL's putalpha do what you want? (provided you *have* PIL)
Yes, I have PIL.

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]
Well, I want to set the alpha value for every pixel.  So, every pixel, regardless of its color should be 50% transparent.  The code I posted does that, but it doesn't save that alpha data to the file.
Ian