
答案1
執行此操作的程序是ansilove
。它已經針對許多發行版進行了打包。
例如:
$ ls --color > /tmp/output.ansi
$ ansilove -o /tmp/output.png /tmp/output.ansi
答案2
作為替代方案安西洛夫,還有安西戈(由同一個人製作,但簡單得多)和安西托影像或者簡訊。
安西托影像
# installation
pip install ansitoimg
# from file to image
ansitoimg /tmp/dcd.log dcd.svg
# pipeline
ls --color=always /etc | ansitoimg ls.svg
# preserving color in pipeline
unbuffer grc ss -nlpt | ansitoimg ss.svg
# use theme and wide screen
dcd -d za.tryhackme.com -s 10.200.28.101 | ansitoimg -w -t /tmp/one-dark.yaml /tmp/dcd.png
簡訊
# from file to image
cat /tmp/dcd.log| textimg -o out.png
# pipeline
ls --color=always /etc | textimg -o out.png
# preserving color in pipeline
unbuffer grc ss -nlpt | textimg -o out.png
# choose font (-f), emoji font (-e) and use emoji font (-i)
dcd -d za.tryhackme.com -s 10.200.28.101 | textimg -f /usr/share/fonts/TTF/Anonymous\ Pro.ttf -e /usr/share/fonts/joypixels/JoyPixels.ttf -i -o /tmp/out.png