环境
Python 3.5.2
Pillow 7.2.0
Pillow 是一个 Python 图像处理库。
安装Pillow
- 安装
1 | pip3 install pillow |
- 查看版本
1 | $ python3 -m pip freeze | grep Pillow |
代码
1 | # -*- coding=utf-8 -*- |
创建 ascii.py,内容如上。
执行
- 图片
准备一张图片,放在与 ascii.py 同级目录下。
- 执行
1 | $ python3 ascii.py Rabbit.png --width=80 --height=50 |