multiple image merging example added

This commit is contained in:
Ruhul Amin 2022-02-17 14:07:44 +06:00
parent 9ae80a804f
commit 9cfcbc17d4
4 changed files with 15 additions and 0 deletions

BIN
docs/example/img/img1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
docs/example/img/img2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

15
docs/example/img_merge.py Normal file
View File

@ -0,0 +1,15 @@
from PIL import Image
#Read the two images
image1 = Image.open('img/img1.jpg')
image2 = Image.open('img/img2.jpg')
#resize, first image
image1 = image1.resize((426, 240))
image1_size = image1.size
image2_size = image2.size
new_image = Image.new('RGB',(2*image1_size[0], image1_size[1]), (250,250,250))
new_image.paste(image1,(0,0))
new_image.paste(image2,(image1_size[0],0))
new_image.save("img/merged_image.jpg","JPEG")
new_image.show()