[PYTHON IMAGE-SIG] Transparent GIF images & Tk

Fred L. Drake fdrake@CNRI.Reston.Va.US
Thu, 19 Dec 1996 09:37:48 -0500 (EST)


  Well, I've finally spent a little time trying to write code using
PIL, and am impressed with the ease I've been able to do simple things
(like converting an image to EPS;), but am a little confused about
even slightly more complex operations.  This is likely because I know
very little about image processing.
  In particular, I would like to be able to show a transparent image
in a Tk widget.  I can load the image and throw it up into the target
widget without problems, but transparent areas become white.
Typically the images will be GIFs, but I'm interested in PNG as well.
  I can get the RGB for the desired background, so I think I should be
able to create an image of the background color using Image.new(), and
a alpha channel (not sure the best way to create this yet), and
combine them using Image.composite(bgimg, img, alpha).
  Unfortunately, I've not figured out how to actually do this.  How do
I compute the color parameter for Image.new() based on RGB?  I tried 
(R<<16 | G<<8 | B), but that doesn't seem to work.
  Any ideas would be greatly appreciated!


  -Fred

--
Fred L. Drake, Jr.
fdrake@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive
Reston, VA    20191-5434

=================
IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org
=================