import PIL.Image as Image import os toImage = Image.new('RGB', (640 * 3, 480 * 3)) # 构造图片的宽和高,如果图片不能填充完全会 dir_root = "C:/Users/JIA/Desktop/PG2019论文素材/柱状图" files = os.listdir(dir_root) count = 0 begin_x = 0 begin_y = 0 for file_name in files: fname = os.path.join(dir_root, file_name) fromImage = Image.open(fname) # fromImage = fromImage.resize((850, 1100)) toImage.paste(fromImage, (begin_x, begin_y)) begin_x += 640 if begin_x % 1920 == 0: begin_x = 0 begin_y += 480 toImage.save('eee.jpg')
python图片排列 横向和纵向同时
最新推荐文章于 2024-08-18 19:29:53 发布