By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,660 Members | 1,102 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,660 IT Pros & Developers. It's quick & easy.

transparent images

P: n/a
Does any one know how to make a transparent image with specifically
PIL, but any standard python library will do. I need a spacer, and it
has to be transparent.

Thanks

May 16 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
mo**********@gmail.com wrote:
Does any one know how to make a transparent image with specifically
PIL, but any standard python library will do. I need a spacer, and it
has to be transparent.

Thanks
Does this have to be done through Python? If not, you might enjoy GIMP
(http://www.gimp.org), which can do this easily. Best of all, you can
customize the size, etc.

Dusty
---
May 16 '07 #2

P: n/a
On May 15, 5:26 pm, moishyyeh...@gmail.com wrote:
Does any one know how to make a transparent image with specifically
PIL, but any standard python library will do. I need a spacer, and it
has to be transparent.

Thanks
Something like this...not my code...untested...

im = Image.open("image.jpg")
opacity = .5
if im.mode != 'RGBA':
im = im.convert('RGBA')
else:
im = im.copy()

alpha = im.split()[3]
alpha = ImageEnhance.Brightness(alpha).enhance(opacity)
im.putalpha(alpha)

~Sean

May 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.