[Image-SIG] GUI with Transparency
Matthew Nuzum
mattnuzum at gmail.com
Sun Jul 3 15:57:41 CEST 2005
On 7/2/05, Christian M. Jensen <christianj at implicitnetworks.com> wrote:
> Hello,
>
> Does anyone know of a GUI toolkit that supports alpha blending using PNGs?
>
> Thanks!
> Christian
Here is a snippet from a program that uses PIL to create a rectangle
with alpha-transparent drop shadow around it. (tmp is an image)
import Image
import ImageFilter
import ImageChops
import sys
# draw a filled rectangle on a white background that leaves 8 - 10 px of white
# around the outside edge of the rectangle
...
# add the drop shadow
new = tmp.filter(ImageFilter.BLUR)
new = new.convert("RGBA")
c = new.convert("L")
c = ImageChops.invert(c)
bands = c.split()
new.putalpha(bands[0])
new.show()
--
Matthew Nuzum
www.bearfruit.org
More information about the Image-SIG
mailing list