博客
关于我
python代码——批量生成灰度图片
阅读量:688 次
发布时间:2019-03-17

本文共 518 字,大约阅读时间需要 1 分钟。

from PIL import Imageimport osimport glob# 图像存储位置.*/input_dir = 'J:/project/images/'# 文件存放位置.*/out_dir = 'J:/project/output/'img_Lists = glob.glob(input_dir + '/*.jpg')img_basenames = []  # e.g. 100.jpgfor item in img_Lists:    img_basenames.append(os.path.basename(item))img_names = []  # e.g. 100for item in img_basenames:    temp1, temp2 = os.path.splitext(item)    img_names.append(temp1)a = os.listdir(input_dir)for i in a:    print(i)    I = Image.open(input_dir + i)    L = I.convert('L')    L.save(out_dir + i)

转载地址:http://fwdhz.baihongyu.com/

你可能感兴趣的文章
mysql的decimal与Java的BigDecimal用法
查看>>
MySql的Delete、Truncate、Drop分析
查看>>
MySQL的Geometry数据处理之WKB方案
查看>>
MySQL的Geometry数据处理之WKT方案
查看>>
mysql的grant用法
查看>>
Mysql的InnoDB引擎的表锁与行锁
查看>>
mysql的InnoDB引擎索引为什么使用B+Tree
查看>>
MySQL的InnoDB默认隔离级别为 Repeatable read(可重复读)为啥能解决幻读问题?
查看>>
MySQL的insert-on-duplicate语句详解
查看>>
mysql的logrotate脚本
查看>>
MySQL的my.cnf文件(解决5.7.18下没有my-default.cnf)
查看>>
MySQL的on duplicate key update 的使用
查看>>
MySQL的Replace用法详解
查看>>
mysql的root用户无法建库的问题
查看>>
mysql的sql_mode参数
查看>>
MySQL的sql_mode模式说明及设置
查看>>
mysql的sql执行计划详解
查看>>
mysql的sql语句基本练习
查看>>
Mysql的timestamp(时间戳)详解以及2038问题的解决方案
查看>>
mysql的util类怎么写_自己写的mysql类
查看>>