【趣味编程】图片转字符
刷抖音看到这么一个视频,还挺火的~
哎哟,这不是图片转字符的升级版么,视频的每一帧图片转换掉再放回去。抖音人才多啊!
正好以前也稍微研究了一丢丢,代码不多,挺有意思的。
以上代码把图片”yorry.jpg”文件名替换成自己的,保存文件为”test.py”,电脑上安装好Python3环境,在当前目录运行:
打开文件”tmp.txt”,生成的字符串就如本文一开始的截图那样了~
原图(yorry.jpg)
不会码代码的小伙伴也可以直接用一些在线工具来转(字符集与本文不同)
https://www.fontke.com/tool/image2ascii/
http://www.makepic.net/tool/image2ascii.html
原文地址
Python实现图片转字符画