python实战 基于PIL库简易实现图像转字符画
如果没有PIL库,则使用命令行安装 python2安装:pip install PIL python3安装:pip install pillow from PIL import Image #字符集:用作字符画的颜色构成 ascii_char = list("$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft|()1{}[]?-_+~i!lI;:,.^`/ ") # get_char函数:将256灰度映射到68个字符上,因为键盘字符集一共有68个 def get_char(r,g,b,alpha=256): if alpha==0: ret
下载地址
用户评论