[Image-SIG] how to make transparent background?

Victor Manuel Rosas-García quimico69@yahoo.com
Sun, 6 Oct 2002 16:02:06 -0700 (PDT)


Hello everybody,

I'm pretty new to image processing and I've been programming with Python and
PIL for a couple of weeks.  Let's say that I have an image on black background
created using the following:

Python 2.2.1 (#1, Sep 25 2002, 11:42:45) 
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-110)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image
>>> import ImageDraw
>>> im = Image.new('RGBA', (400,400), 0)
>>> d = ImageDraw.ImageDraw(im)
>>> d.rectangle((100,100,300,300), fill=255)

now I have a red square surrounded by black background.  How can I make the
background transparent?

I'm using PIL 1.1.3


=====
Victor M. Rosas García
Theoretical Chemistry Apprentice

e-mail: quimico69@yahoo.com

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com