[pygtk] Combining images
MLA (Peter Clark)
mla at forrussia.org
Mon Nov 10 22:28:55 WST 2008
I am trying to figure out how to combine images using PyGTK, and after Google
didn't turn up anything helpful, I thought I would ask the list. What I want
to do is place two images (image1.png and image2.png) on top of a third
(background.png). image1 and image2 are transparent, so I need to create a
mask for each of them. image1 is the same size as the background, so its box
is just the upper left corner; image2 is a much smaller image that goes in a
specific location. If I do this with PIL (the Python Imaging Library), it's
dead simple:
import Image
back = Image.open('background.png')
image1 = Image.open('image1.png')
image2 = Image.open('image2.png')
# paste(image, box, mask)
back.paste(image1, (0, 0), image1)
back.paste(image2, (3, 40), image2)
back.save('result.png')
However, I would prefer not to pull in an extra dependency. How can I do the
same GTK?
Thanks,
:Peter
More information about the pygtk
mailing list