'How to delete borders from png image pasted on another in Pillow?

I have 2 imgs:

First

first

And second

and second

Here's code

from PIL import Image

img1 = Image.open('rainbow.jpg')
img2 = Image.open('smile.png')

img1.paste(img2)
img1.save('img.png')

I need to put second img on first, but when I try it on second img appears borders and result is:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source