Ask Your Question
0

How can I combine 2 photos from specific pixels?

asked 2020-04-15 06:06:46 -0600

ziknehupsu gravatar image

updated 2020-04-15 20:53:59 -0600

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-04-16 05:41:35 -0600

Lython gravatar image

updated 2020-04-16 07:31:09 -0600

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')
edit flag offensive delete link more

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 ( 2020-04-17 14:36:02 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-04-15 06:06:46 -0600

Seen: 220 times

Last updated: Apr 16 '20