Python 使用PIL numpy 实现拼接图片
2017-04-27 19:55
1031 查看
python纵向合并任意多个图片,files是要拼接的文件list
# -*- coding:utf-8 -*- def mergeReport(files): from PIL import Image import numpy as np baseimg=Image.open(files[0]) sz = baseimg.size basemat=np.atleast_2d(baseimg) for file in files[1:]: im=Image.open(file) #resize to same width sz2 = im.size if sz2!=sz: im=im.resize((sz[0],round(sz2[0] / sz[0] * sz2[1])),Image.ANTIALIAS) mat=np.atleast_2d(im) basemat=np.append(basemat,mat,axis=0) report_img=Image.fromarray(basemat) report_img.save('merge.png')
相关文章推荐
- Python 使用PIL numpy 实现拼接图片的示例
- Python使用PIL库实现验证码图片的方法
- python使用PIL模块实现给图片打水印的方法
- Python使用PIL库实现验证码图片的方法
- python使用pil库实现图片合成实例代码
- Python中使用PIL库实现图片高斯模糊实例
- python使用PIL模块实现给图片打水印的方法
- Python中使用PIL库实现图片高斯模糊实例
- python处理图片之PIL模块简单使用方法
- python处理图片之PIL模块简单使用方法
- Python宝典第八、九章:Python多媒体编程及使用PIL处理图片
- 使用CSS mask实现图片斜线拼接效果
- python实现通过pil模块对图片格式进行转换的方法
- python处理图片之PIL模块简单使用
- Python的PIL库实现验证码图片
- 使用Python的PIL模块来进行图片对比
- 在Python中使用PIL模块对图片进行高斯模糊处理的教程
- python,使用PIL库对图片进行操作
- C# WinForm 使用多种方法实现 图片的切割和拼接
- python之利用PIL库实现页面的图片验证码及缩略图 推荐