PIL - Transparency Nightmares

T

tac-tics

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?
 
T

tac-tics

I RTFM harder, and found that paste with an image mask (using the
watermark as the mask) does the trick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top