python 处理图片 排列 复制 粘贴

from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw



list=['orange','red','blue','green','purle']
for t in list:
    toImage = Image.new('RGB', (956 * 5, 599 * 6),'white')
    images=r'/usr/local/var/python/zj/PythonApplication1/PythonApplication1/imgs/'+t+'.jpg'
    fromImage = Image.open(images)
    begin_x = 0
    begin_y = 0
    for i in range(6):
        for j in range(5):
            toImage.paste(fromImage, (begin_x, begin_y))
            begin_x += 956 #   
        if begin_x % 4780 == 0:
            begin_x = 0
        begin_y+=599
    toImage.save(t+'1.jpg',quality=95)

posted @ 2020-12-25 09:58  尘梦  阅读(345)  评论(0编辑  收藏  举报