the merging of two images using python pillow

Solutions on MaxInterview for the merging of two images using python pillow by the best coders in the world

showing results for - "the merging of two images using python pillow"
Naila
03 Jan 2019
1from PIL import Image
2#Read the two images
3image1 = Image.open('images/elephant.jpg')
4image1.show()
5image2 = Image.open('images/ladakh.jpg')
6image2.show()
7#resize, first image
8image1 = image1.resize((426, 240))
9image1_size = image1.size
10image2_size = image2.size
11new_image = Image.new('RGB',(2*image1_size[0], image1_size[1]), (250,250,250))
12new_image.paste(image1,(0,0))
13new_image.paste(image2,(image1_size[0],0))
14new_image.save("images/merged_image.jpg","JPEG")
15new_image.show()