Combine images

To combine (paste) an image on top of another image, we can use the paste() method. This method takes two parameters – the image we want to paste on top of another image, and the area where to paste it.

We can use the paste() method to create watermarks. This is the logo of my website:

I want to paste the geek-university logo on top of the other image, in the bottom left corner. Here is how I would do just that:

img_1 = Image.open('handsome.jpg')
img_2 = Image.open('geek-university.png')

area = (51, 1480)

img_1.paste(img_2, area, img_2)
img_1.show()

The paste method accepts three arguments:

img_2 – the image that will be pasted on img_1
area – the upper left corner of the pasted image will be placed on coordinates 51, 1400
img_2 – this third (optional) parameter specifies that the transparent background of img_2 will not be pasted.

The result:

Geek University 2022