首先上来给了一张gif,一条细细的线。思路:将其分成单一的图片再进行拼接。
这里使用python3利用PIL库写的代码。
import os
from PIL import Image
im = Image.new('RGB', (2*201,600))#new(mode,size) size is long and width
PATH = '你的路径'
FILE_NAME = [i for i in os.listdir(PATH)]//这才是python的正确写法,kukuku
width = 0
for i in FILE_NAME:
im.paste(Image.open(PATH+i),(width,0,width+2,600))#box is 左,上,右,下
width += 2
im.show()
im.paste(Image.open(PATH+i),(width,0,width+2,600))
如果不加0 ,600的话就成了这样。。。
这里用到了PIL的几个库,回头我再专门写一篇关于PIL的文章。
点击链接