PIL - Transparency Nightmares

tac-tics tactics40 at gmail.com
Mon Jul 10 11:27:03 EDT 2006


I'm trying to make a simple script which attaches watermarks to every
image in one directory and saves the output image to another. However,
while I understand (in theory at least) what I need to be doing, I
can't figure out where to go from here.

First of all, I have a watermark image and a list of small images
around 120px squared. The watermark uses alpha transparency, so the
background is transparent and the anti-aliased text is partially
transparent. For each image, I crop the watermark to the same size as
the image. Now all I need to do is paste the watermark over the old
image with respect to its transparency.

I've tried Image.blend(), Image.composite(), and im.paste(), but none
of them seem to do exactly what I want. What am I missing here?




More information about the Python-list mailing list