How to paste a smaller image onto a bigger image at the center using Pillow?

By Soham Banerjee

enter image description here

I am trying to edit the bigger image by adding ImageFilter and resizing it to a larger dimension. Then I am pasting the original Image back into the edited one. but it is getting pasted at the top left corner. I want it to be at the center.

My code is –

 size3 = (1800,2200)
 ima3 ="101602040.jpg")"101602040.jpg").resize(size3).filter(ImageFilter.GaussianBlur(20)).save("gauss.jpg")
box = (0,0,ima3.size[0],ima3.size[1])
region = ima3.crop(box) #select the complete original image
ima4 ="gauss.jpg") #open the new resized image
ima4.paste(region,box) #paste the original into the edited one

What I want is like this –

Source: Stack Overflow


Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273