DEV Community

Brandon Rozek
Brandon Rozek

Posted on • Originally published at brandonrozek.com on

Term To SVG

With termtosvg made by Nicolas Bedo we can make SVG animations from terminal output in the style of asciinema. To install use pipx.

pipx install termtosvg

Enter fullscreen mode Exit fullscreen mode

To start recording, run the command termtosvg

termtosvg

Enter fullscreen mode Exit fullscreen mode

It first outputs:

Recording started, enter "exit" command or Control-D to end

Enter fullscreen mode Exit fullscreen mode

At “exit”, by default it will save the animation to a random filename in the tmp folder.

Rendering ended, SVG animation is /tmp/termtosvg_xmadgf9y.svg

Enter fullscreen mode Exit fullscreen mode

To control the default save location, pass in a filename after termtosvg

termtosvg /path/to/savefile.svg

Enter fullscreen mode Exit fullscreen mode

To record only the execution of a particular command, use the flag -c

termtosvg -c neofetch

Enter fullscreen mode Exit fullscreen mode

I recommend that you resize the terminal window so that the frames generated match the desired width and height. You can instead use the -g flag to pass in a geometry. (“100x30” creates a screen with 100 colums and 30 rows)

Lastly, if you don’t want an animation, you can pass in -s and the result will be a folder of SVG files representing each frame.

termtosvg -s

Enter fullscreen mode Exit fullscreen mode

Here is an example of an animation I made with this tool:

Top comments (0)