Ask Your Question
0

How can I combine 2 photos from specific pixels?

asked Apr 15 '0

ziknehupsu gravatar image

updated Apr 16 '0

supra56 gravatar image

Hello everyone,

I have two photos.

I want to put these photos on a new plane. The corner coordinates of first photo are

[100,100], [200,100], [200,200] [100,200] (on new plane coordinates)

Corner coordinates of the second photo are

[110,110] [210,110], [210,210], [110,210]. (on new plane coordinates)

How can I do this?

E.g like this ;

Like this

Preview: (hide)

1 answer

Sort by » oldest newest most voted
0

answered Apr 16 '0

Lython gravatar image

updated Apr 16 '0

supra56 gravatar image

Code:

import image module from pillow
from PIL import Image  

#open the image
Image1 = Image.open('your image 1') 

#make a copy the image so that   the
# original image does not get affected
Image1copy = Image1.copy() 
Image2 = Image.open('your image 2') 
Image2copy = Image2.copy() 


#paste image giving dimensions
Image1copy.paste(Image2copy, (70, 150))  # pick your coordinates


#save the image
Image1copy.save('D:\pasted2.png')
Preview: (hide)

Comments

There are transparent areas in the photos and they carry it. The characteristic of transparent regions is that they are not visible.

ziknehupsu gravatar imageziknehupsu (Apr 17 '0)edit

Question Tools

1 follower

Stats

Asked: Apr 15 '0

Seen: 280 times

Last updated: Apr 16 '20