[Python] 纯文本查看 复制代码
from PIL import Image as img
#dpi=int(input("请输入底图分辨率:"))
dpi=1200
#坐标点
xy=[(-dpi,-dpi),(0,0),(dpi,0),(dpi*2,0),(0,dpi),(dpi,dpi),(dpi*2,dpi),(0,dpi*2),(dpi,dpi*2),(dpi*2,dpi*2)]
#各图位置
imgs=[(6,8,9),(4,6,7,8,9),(4,7,8),(1,2,3,4,5,6,8,9),(1,2,3,4,5,6,7,8,9),(1,2,3,4,5,6,7,8),(3,0),(1,2,3,4,5,6,8),(1,0)]
name=1
f1=img.open("./test.jpg") #读取test图片
new_f1=f1.resize((dpi,dpi),img.BILINEAR)
for i in imgs:
f2=img.new("RGB",(dpi*3,dpi*3),(255,255,255))
for x in i:
f2.paste(new_f1,xy[x])
f2.save(str(name)+".jpg")
name+=1
print("OVER!")