ConsoleToSvg 0.6.5
dotnet tool install --global ConsoleToSvg --version 0.6.5
dotnet new tool-manifest
dotnet tool install --local ConsoleToSvg --version 0.6.5
#tool dotnet:?package=ConsoleToSvg&version=0.6.5
nuke :add-package ConsoleToSvg --version 0.6.5
console2svg
Easily convert terminal output into SVG images. truecolor, animation, cropping and many appearance options are supported.
Of course, this hero image is generated using console2svg itself.
Why console2svg?
Console screenshots in raster formats (PNG, etc.) often make text look blurry. console2svg converts console output into vector SVG images so you can save your terminal as a crisp, scalable image.
For example, let's open this image in your browser and zoom in — the text remains sharp at any scale 👀
There are similar tools, but console2svg stands out for:
- No dependencies: no additional software or libraries required. available as npm, dotnet tool and static binary.
- Video mode: save command execution animations as SVG. great for documentation and blog posts.
- Crop: trim specific parts of the output. Crop based on text patterns is also supported, making it easy to trim specific lines or sections.
- Background and window: add background and window frames to produce presentation-ready SVGs for documentation, blogs, social media, etc.
- CI friendly: with features like replay and timeout, it can generate both static and animated SVGs in CI environments, minimizing discrepancies between code and images.
- Windows support: works on Windows, macOS and Linux.
Overview
The simplest way to use it is to just put the command you want to run after console2svg. For example, the following command converts the description text of console2svg into SVG (oh, how meta).
console2svg console2svg
You can also generate SVG with a window frame. and some options to customize the appearance.
For example, -w specifies the width, -c is an option to display the command at the beginning of the output, and -d is an option to specify the style of the window frame, where we specify a macOS-like frame. If the command is long, you can also write it together after --.
console2svg -w 120 -c -d macos-pc -- console2svg
In video mode(-v), you can capture the animation of the command execution and save it as an SVG.
By using the replay feature, you can save the command execution record and later regenerate the SVG based on that record.
console2svg -v -c -d macos -- copilot --banner
Install
You can install it as a global tool using the dotnet or npm package manager.
# dotnet global tool
dotnet tool install -g ConsoleToSvg
# npm global package
npm install -g console2svg
It is also available as a standalone binary that you can download from the releases page and add to your PATH.
# ubuntu
curl -sSL https://github.com/arika0093/console2svg/releases/latest/download/console2svg.amd64.deb -o console2svg.deb
dpkg -i console2svg.deb
# linux
curl -sSL https://github.com/arika0093/console2svg/releases/latest/download/console2svg-linux-x64 -o console2svg
mv -f console2svg /usr/local/bin/
chmod +x /usr/local/bin/console2svg
# windows (cmd)
curl -sSL https://github.com/arika0093/console2svg/releases/latest/download/console2svg-win-x64.exe -o console2svg.exe
GitHub Actions
A convenient GitHub Action is also available for use in CI. To use the latest version of console2svg, simply add the following step to your workflow:
- uses: arika0093/console2svg@main
<details> <summary>Example usage in GitHub Actions</summary>
Full workflow example that generates an SVG and commits it back:
jobs:
gen:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup console2svg
uses: arika0093/console2svg@main
- name: Generate SVG
run: console2svg -w 120 -c -d macos-pc -o output.svg -- dotnet --version
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "[skip-ci] chore: regenerate SVG"
</details>
<details> <summary>CI environment variables override</summary>
Some libraries (for example chalk) detect CI environments and automatically disable color output. However, when generating SVGs you always want color enabled. Therefore, console2svg automatically sets and removes the following environment variables by default:
TERM=xterm-256color: set to enable color support.COLORTERM=truecolor: enable TrueColor output.FORCE_COLOR=3: same;3indicates TrueColor.CI(deleted): removed because some libraries disable color when they detect a CI environment.TF_BUILD(deleted): removed for the same reason (used by Azure Pipelines).
To disable this behavior, use the --no-colorenv and --no-delete-envs options.
</details>
This repository uses this action itself to automatically regenerate all the SVG images in the assets/ directory whenever a new release is published.
Usage
Pipe mode
Width and height default to the current terminal dimensions.
my-command | console2svg
PTY command mode
Width is 100 characters by default, and height is automatically adjusted to fit the content.
console2svg "git log --oneline"
# or
console2svg -- git log --oneline
If you want to set a fixed width and height, you can use the -w and -h options.
console2svg -w 120 -h 20 -- git log --oneline
Static SVG with crop
You can crop the output by specifying the number of pixels or characters to crop from each side.
# ch: character width, px: pixel
console2svg --crop-top 1ch --crop-left 5px --crop-right 30px -- your-command
You can also crop at the position where a specific character appears.
When specifying a character, you can specify it like :(number), which crops at a relative position from the detected line.
For example, the following example crops from the line where the character Host is located to 2 lines above the line where the character .NET runtimes installed: is located.
console2svg --crop-top "Host" --crop-bottom ".NET runtimes installed:-2" -- dotnet --info
The result will look like this.
Animated SVG
use -m video or -v to capture the animation of the command execution and save it as an SVG.
# apt install sl
console2svg -c -d -v -- sl
You can specify the --timeout option to output SVG after a certain time has elapsed.
This is useful for converting commands that do not terminate, such as nyancat, into SVG.
There is also a --sleep option to specify the stop time after playback. This allows you to display the last frame for a specified time after the command execution is finished.
# apt install nyancat
console2svg -w 160 -h 32 -c -d -v --timeout 5 --sleep 0.5 -- nyancat -d 10
You can also write sequential SVG files starting with frame-0000.svg to a specific folder.
This is useful for cherry-picking your favorite frames or converting them into a video using software like ffmpeg.
See Converting to video for details.
# apt install cmatrix
console2svg -c -d -v --timeout 5 --fps 30 --save-frames ./frames-dir -- cmatrix -ab
Replay input
You can also save the command execution record and later regenerate the SVG based on that record.
To save the record, use the --replay-save option to save the command execution.
console2svg --replay-save ./replay.json -- bash
# save key inputs to replay.json
Then, generate the SVG based on the saved key input. By using this feature, you can generate an SVG that records terminal operations as shown below.
console2svg -w 80 -h 20 -v -c -d macos --replay ./replay.json -- bash
The replay file is in a simple JSON format. If you make a mistake in the input, you can directly edit this file (or of course, you can ask AI to fix it for you).
<details> <summary>Replay file format</summary>
// replay.json
{
"version": "1",
"appVersion": "0.4.0.2+17cc95284e",
"createdAt": "2026-03-01T06:52:43.3615812+00:00",
// If more than 1 second has passed from the total time,
// it will exit with an error as a timeout.
"totalDuration": 10.9530099,
"replay": [
{
// first event: absolute time from recording start (seconds)
"time": 1.5,
"key": "e",
"modifiers": [],
"type": "keydown"
},
{
// subsequent events: delta from the previous event (seconds)
"tick": 0.08,
"key": "c",
"modifiers": ["shift"],
"type": "keydown"
},
// and so on...
]
}
</details>
Appearance options
Background and opacity
You can set the background color or image of the output SVG, and adjust the opacity of the background fill.
console2svg -h 10 -c -d macos-pc --background "#003060" --opacity 0.85 -- dotnet --version
You can also set a gradient background.
console2svg -h 10 -c -d macos-pc --background "#004060" "#0080c0" --opacity 0.85 -- dotnet --version
Image background is also supported.
console2svg -h 10 -c -d macos-pc --background image.png --opacity 0.85 -- dotnet --version
Terminal Appearance
You can customize the appearance with various options.
For example, in the following example, the prompt (the string displayed at the beginning) is changed to [HELLO!] $,
the command header is changed to my-custom-header, and the text color is changed to #00f040.
console2svg -h 4 --prompt "[HELLO!] $" --header "my-custom-header" --forecolor "#00f040" --backcolor "#042515" -- echo "hi"
Window chrome
-d option allows you to specify the style of the window frame.
| Image | Style(-d) |
Description |
|---|---|---|
| <img src="./assets/window/none.svg" width="400" alt="none"> | none |
no window frame |
| <img src="./assets/window/transparent.svg" width="400" alt="transparent"> | transparent |
transparent background (text-only output) |
| <img src="./assets/window/macos.svg" width="400" alt="macos"> | macos |
macOS style window frame |
| <img src="./assets/window/windows.svg" width="400" alt="windows"> | windows |
Windows Terminal style window frame |
*-pc styles are designed for use with a background, and include padding and shadows to create a "window" effect. You can also customize the padding with the --pc-padding option.
| Image | Style(-d) |
|---|---|
| <img src="./assets/window/macos-pc.svg" width="400" alt="macos-pc"> | macos-pc |
| <img src="./assets/window/windows-pc.svg" width="400" alt="windows-pc"> | windows-pc |
Tips
Using with tmux
By combining with tmux, you can save the step-by-step execution process of commands as SVG images.
First, open tmux. If it's not installed, install it using apt install tmux or brew install tmux, etc.
tmux
Execute commands in the default window (:0).
$ echo "say hello"
$ echo "say goodbye"
After completing the command execution you want to record, open a new window with ctrl+b c. Then, run tmux capture-pane | console2svg to save the content of the original window as SVG.
# tmux options:
# -p: print the captured content to stdout
# -e: include escape sequences (for colors, etc.)
# -t :0: target the first pane (you can specify other panes as needed)
# console2svg options:
# -h 12: set the height of the output SVG to 12 lines (adjust as needed)
tmux capture-pane -pe -t :0 | console2svg -h 12 -o capture-$(date +%s).svg
<details> <summary>Recording and replaying tmux usage</summary>
With the power of console2svg, you can even record and explain how to use console2svg itself 😃
</details>
<details> <summary>tmux capture-pane result example</summary>
</details>
Then repeat the workflow: press ctrl+b p to return to the original window, work on your commands, press ctrl+b n to switch to the SVG capture pane, and run the console2svg command. This allows you to progressively save the command execution process as SVG images.
Of course, you can also save all lines (useful for evidence). In that case, specify the -S - option on the tmux side to capture the entire screen.
tmux capture-pane -pe -S - -t :0 | console2svg -o full-capture-$(date +%s).svg
Converting to other image formats
By combining with various commands, you can also convert to PNG or other formats. One of the easy-to-use tools is rsvg-convert. It only converts to PNG format, but it's easy to use.
apt install librsvg2-bin
# use --stdout to write SVG to stdout, then pipe to rsvg-convert to convert to PNG
console2svg --stdout -- your-command | rsvg-convert -o output.png
# Pipe mode also works
your-command | console2svg --stdout | rsvg-convert -o output.png
ImageMagick can also be used. It supports formats other than PNG, but it may take a little effort to install.
# apt version may be outdated, so it's better to install from the official site
# install v7 or later (v6 may have issues with SVG conversion)
sudo curl -sSL https://imagemagick.org/archive/binaries/magick -o /usr/local/bin/magick
sudo chmod +x /usr/local/bin/magick
# check version
magick -version
# convert SVG to PNG
console2svg --stdout -- your-command | magick - output.png
Converting to video
To convert to video, first save the sequential SVG files using the --save-frames option.
Then, use ffmpeg to convert these SVG files into a video. Here is an example of the process.
# install required tools if you haven't already
sudo apt install ffmpeg
# 1. Save sequential SVG files
# specify --save-frames and --fps to save each frame as an SVG file in the specified directory
console2svg -c -d macos-pc -v --timeout 5 --fps 30 --save-frames ./frames-dir -- your-command
# 2. Convert SVG frames to video using ffmpeg
ffmpeg -framerate 30 -i ./frames-dir/frame-%04d.svg -c:v libx264 output_video.mp4
The generated video will look like this.
Supported platforms
- Windows 10 and later (required
ConPTY) - Linux (tested on Ubuntu 24.04, but should work on other distributions as well)
- macOS (ver 0.6.2 and later support macOS(arm64) natively)
Options
Major options
-o: Output SVG file path (default:output.svg)-c: Prepend the command line to the output as if typed in a terminal.-w: width of the output SVG (default: terminal width[pipe], 100ch[pty])-h: height of the output SVG (default: terminal height[pipe], auto[pty])-v: output to video mode SVG (animated, looped by default)-d: window chrome style (none, macos, windows, macos-pc, windows-pc, transparent, ...)--background: background color or image for the output SVG--forecolor: override default console foreground color--header: override command header text (shown even without-c)--prompt: override prompt prefix for-c(default:$or#when root)--verbose: enable verbose logging--crop-*: crop the output by specified pixels, characters, or text patterns
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.6.5 | 126 | 3/30/2026 |
| 0.6.4 | 110 | 3/8/2026 |
| 0.6.3 | 101 | 3/7/2026 |
| 0.6.2 | 104 | 3/6/2026 |
| 0.6.1 | 100 | 3/6/2026 |
| 0.6.0 | 100 | 3/6/2026 |
| 0.5.3 | 99 | 3/6/2026 |
| 0.5.2 | 98 | 3/4/2026 |
| 0.5.1 | 97 | 3/3/2026 |
| 0.5.0 | 104 | 3/2/2026 |
| 0.4.11 | 104 | 3/2/2026 |
| 0.4.10 | 102 | 3/2/2026 |
| 0.4.9 | 103 | 3/2/2026 |
| 0.4.8 | 101 | 3/2/2026 |
| 0.4.7 | 98 | 3/2/2026 |
| 0.4.6 | 100 | 3/1/2026 |
| 0.4.5 | 97 | 3/1/2026 |
| 0.4.4 | 102 | 3/1/2026 |
| 0.4.3 | 98 | 3/1/2026 |
| 0.4.2 | 96 | 3/1/2026 |