ptthon拼图
from PIL import Image # 打开图像文件 image = Image.open("input_image.jpg") # 获取图像的宽度和高度 width, height = image.size # 创建一个新的图像,将原始图像复制到其上 new_image = Image.new("RGB", (width, height)) for x in range(width): for y in range(height): new_image.putpixel((x, y), image.getpixel((x, y))) # 保存新图像 new_image.save("output_image.jpg")
===========