I want to merge multiple images into one single image horizontaly. I tried to merge images through given code but it gives white image? For merge Images I tried PIL .
import sys
from PIL import Image
def append_images(images,bg_color=(255,255,255), aligment='center'):
widths, heights = zip(*(i.size for i in images))
new_width = sum(widths)
new_height = max(heights)
new_im = Image.new('RGB', (new_width, new_height), color=bg_color)
offset = 0
for im in images:
y = 0
if aligment == 'center':
y = int((new_height - im.size[1])/2)
elif aligment == 'bottom':
y = new_height - im.size[1]
new_im.paste(im, (offset, y))
offset += im.size[0]
return new_im
date=input("Enter Date:")
l=['1.jpg','2.jpg','3.jpg']
images = map(Image.open,l)
combo_2 = append_images(images, aligment='center')
combo_2.save('combo_2.jpg')