mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-20 04:04:45 +03:00
multiple image merging example added
This commit is contained in:
parent
9ae80a804f
commit
9cfcbc17d4
BIN
docs/example/img/img1.jpg
Normal file
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
BIN
docs/example/img/img2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 86 KiB |
BIN
docs/example/img/merged_image.jpg
Normal file
BIN
docs/example/img/merged_image.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
15
docs/example/img_merge.py
Normal file
15
docs/example/img_merge.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user