this is the original back image this is the original front image this is my code:
from PIL import Image
front=Image.open('/users/apple/Desktop/TMP.jpeg')
back=Image.open('/Users/apple/Desktop/原始图片/084.jpeg')
front=front.rotate(100,expand=True)
back.paste(front,(100,100))
back
this is what i get. i want a clean paste without cropping sides. can somebody help me ,thanks.
You need to generate a mask that you can pass to paste to exclude the new black edges.
mask = Image.new('L', front.size, 255)
front = front.rotate(100, expand=True)
mask = mask.rotate(100, expand=True)
back.paste(front, (100,100), mask)

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With