import Image
def image_joint(image_list,opt):#opt= vertical ,horizontal 选择水平显示拼接的图像,或者垂直拼接
image_num=len(image_list)
image_size=image_list[0].size
height=image_size[1]
width=image_size[0]
if opt=='vertical':
new_img=Image.new('RGB',(width,image_num*height),255)
else:
new_img=Image.new('RGB',(image_num*width,height),255)
x=y=0
count=0
for img in image_list:
new_img.paste(img,(x,y))
count+=1
if opt=='horizontal':
x+=width
else : y+=height
return new_img
python image 图像拼接显示
最新推荐文章于 2023-07-21 20:18:36 发布