将图像渲染到ANSI终端的小脚本
img-term的Python项目详细描述
图2 ANSI
将图像转换为ANSI格式的表示形式
安装
pip install img_term
用法
usage: img_term [-h] [-img IMG] [-width WIDTH] [-cam CAM] [-col {4,8,24}]
Display image to terminal
optional arguments:
-h, --help show this help message and exit
-img IMG Image file to display
-width WIDTH Character width of output
-cam CAM Show camera, this is the default
-col {4,8,24} Colour scheme to use
在终端中显示图像
img_term -img dog.jpg
将视频捕获设备呈现到终端:
img_term
选择调色板:
./img_term.py -img lena.jpg -col 24
示例
从这里开始:
对此:
或者这个
对此:
甚至渲染视频:
./img_term.py -col 24 -vid unrealset.mkv -width 78
https://gfycat.com/IdolizedSomeGemsbuck
或者直接把你的USB摄像头流到终端!:
https://gfycat.com/RemarkablePalatableKob