Creating translucent realistic watermarks with PIL library in Python

Things to accomplish:
1. Find a picture you want to watermark. This will be referred to as background
2. Find a logo or text that will be your watermark, this will be referred to as watermark.
3. The objective is to paste a translucent watermark over the background.

from PIL import Image, ImageDraw, ImageFont

Here is my approach:
Step 1: Import PIL library

Step 2: Create your watermark


if your watermark is text, then you need to create an image with just the text with a transparent background. Here’s how thats done:
1. Create an ‘RGBA’ image with a transparent background. By setting the ‘A’ parameter in RGBA to zero, you get a transparent image

Here i’ve set ‘A’ attribute to 100 so you can see a translucent image, when doing this yourself set ‘A’ attribute to zero

now you have a transparent canvas for watermark.

2. Write the text on this image that is to be the watermark. This is done using the draw function from PIL

The text, in this case, is white (because RGB channels are 255 each). The transparency of the image is 100 (255 is opaque and 0 is transparent)


If the watermark is an image that you have ready, all you’ve to do is convert the image to ‘RGBA’. To do this:

Step 3: Paste the watermark over the background (image to be watermarked)

The final step is to simply paste the watermark on background using paste function.

Background and watermark hold the same meanings as the definition above

all functions have an (x,y) coordinate system to place the text/images wherever you want.
‘RGBA’ is denoted by 4 numbers as (r,g,b,a), r=255,g=255,b=255 is white and r=0,g=0,b=0 is black
a = 0 is completely transparent and a = 255 is completely opaque.

I love anything that makes me think. Check out my github here: Get in touch with me on LinkedIn at

Love podcasts or audiobooks? Learn on the go with our new app.