# -*- coding: gbk -*-
# 2022/1/4
# PyCharm
# author='曹家伟',
# author_email='studyss@qq.com',
# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple 库名
# pip --default-timeout=100 install -U 库名
# 拼接两张图片使用
from PIL import Image, ImageDraw,ImageFont
def hebing():
imgtop = Image.open("C:\Users\admin\Desktop\1\temp\1.0.JPG") #图片1路径
for i in range(46):
i=i+1
print(i)
file_in = 'C:\Users\admin\Desktop\1\temp\yun\' + str(i) + '.0.JPG'
imglow=Image.open(file_in)
file_out = 'C:\Users\admin\Desktop\1\temp\img\' + str(i) + '.0.JPG'
rrr=Image.new('RGB',(3453,4122),(255,255,255)) #创建的新图的宽和高
rrr.paste(imgtop,(0,0)) #从0,0开始贴图
rrr.paste(imglow,(0,500)) #从0,500开始贴图 贴图高度根据第一个图高度判断
rrr.save(file_out) #合成后图片所放路径
if __name__ == '__main__':
hebing()