How do I get Tk to recognize the transparency in my GIF images?
|
|
Tk uses a hack for transparency in GIF images. If you have a GIF89
image that has the transparency index set, you need to set the global
Tcl variable `TRANSPARENT_GIF_COLOR` to the color which you want the
show through (in general, the background of the widget you are placing
it on). Use the following code as an example:
label .x
set TRANSPARENT_GIF_COLOR [.x cget -bg]
image create photo x -file image.gif
.x configure -image x
Donal Fellows has a minimal C extension to support real transparency at
http://r8h.cs.man.ac.uk:8000/tcl/transPhoto.c
Tk8 removes the need for this hack, properly implementing transparency
in GIF images (some bugs may still exist).
|
|
|