I like to be able to save the output of a shell command as a PNG image without losing the formatting. Kind of like taking a screenshot of the output.

some-command-with-color | text-to-png a.png

I know this command converts text to PNG, but it doesn’t preserve color:

tldr -c tldr | convert -page  4000x4000 -font FreeMono -pointsize 20  -background white -trim +repage -bordercolor white  -border 15 text:- png:a.png

enter image description here

  • @terdon Not really, there is no running terminal emulator to take a screenshot of. I want a script to convert ansi output to png.
    – HappyFace
    Mar 31 '20 at 14:24

A program that does that is ansilove. It is already packaged for many distributions.

For example:

$ ls --color > /tmp/output.ansi
$ ansilove -o /tmp/output.png /tmp/output.ansi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.