
答え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