Skip to main content

term2gif

Record a terminal session and save it as a GIF, in a single binary (term2gif) for GNU/Linux and Windows, with no external tools to install.

term2gif [OPTIONS] <OUTPUT.gif>
term2gif demo.gif                                    # record a shell session
term2gif demo.gif -c 'ls -la'                        # record one command
term2gif demo.gif --theme monokai --speed 1.5 --idle-time-limit 2
term2gif demo.gif --keep-cast demo.cast              # also keep the .cast file
term2gif demo.gif --from-cast demo.cast              # render an existing recording
term2gif demo.gif --bitmap-font fixed                # look like xterm's default font

Inside xterm (or uxterm), the GIF uses xterm's font automatically (see below).

End the recording by exiting the shell (exit / Ctrl-D).

Options

Recording:

Option Meaning
-c, --command <COMMAND> Record this command instead of an interactive shell
--title <TITLE> Store a title in the recording
--keep-cast <FILE> Also keep the asciicast (.cast) recording
--from-cast <FILE> Do not record; render an existing asciicast v2 or v3 file

Rendering and timing:

Option Default Meaning
--theme <THEME> asciinema asciinema, dracula, monokai, nord, solarized-dark, solarized-light, or 10 / 18 comma-separated hex colors (background, foreground, 8 normal [, 8 bright])
--font-family <FAMILIES> System font families to prefer over the built-in font, comma-separated
--bitmap-font <NAME> X11 bitmap font as in xterm: fixed, 9x15, …, an XLFD name (wildcards allowed) or a .pcf / .pcf.gz file; replaces --font-size and --line-height
--font-size <PX> 14 Font size in pixels
--no-font-detect Inside xterm, use the built-in font instead of xterm's
--line-height <N> 1.4 Line height as a multiple of the font size
--scale <N> 1 Make the GIF N times larger (1–8): bitmap fonts get larger pixels (stays crisp), other fonts a larger font size
--bold-is-bright Draw bold text in the bright variant of its color
--speed <N> 1 Playback speed multiplier
--idle-time-limit <SECS> 5 Shorten pauses to at most this long (0: keep all pauses)
--fps-cap <FPS> 30 Maximum frames per second (1–50)
--last-frame-duration <SECS> 3 How long to show the last frame
--no-loop Play the animation only once
-q, --quiet Print only errors
-v, --verbose Print details, such as the detected xterm font

How it works

  • Recording: the shell or command runs in a PTY via portable-pty (Unix PTY, Windows ConPTY). Its output is shown in your terminal and written to an asciicast v2 file in a temporary location, which is deleted afterwards unless you use --keep-cast.
  • Rendering: the recording is replayed through a virtual terminal (avt, the one asciinema uses), and each frame is drawn with the built-in DejaVu Sans Mono font (swash for rasterizing). Box drawing and block characters are drawn directly, so lines connect at any line height.
  • X11 bitmap fonts (--bitmap-font): the classic xterm fonts in PCF format, found through the fonts.dir / fonts.alias files of the X11 font directories (on Debian: package xfonts-base). As in xterm (uxterm), the ISO 10646 version of the font is used, with its bold variant (or overstriking, if there is none) and a double-width font of the same height for CJK characters (e.g. 12x13ja for fixed). Characters the bitmap fonts lack are drawn with the other fonts, scaled to the cell size. On Windows, pass a font file.
  • xterm font detection: when term2gif runs inside xterm (recognized by its reply to the XTVERSION query, or an xterm parent process) and no font option is given, it uses the font xterm uses. It asks xterm for its current font (OSC 50; needs XTerm*allowFontOps: true, and then also follows changes from the font menu), and otherwise takes it from the xterm command line (-fn, -fa, -fs, -class UXTerm), the X resources (xrdb -query: font, faceName, faceSize, renderFont) or xterm's default fixed. TrueType fonts (faceName) are used at xterm's size, with the font's own line height as in xterm.
  • Unicode: wide characters (CJK, emoji) take two cells. Characters missing from the font are taken from any installed font (fontdb); color emoji fonts (e.g. Noto Color Emoji, Segoe UI Emoji) are preferred for emoji.
  • Resizing: window resizes during recording are forwarded to the program and recorded. A GIF has one fixed size, so it is as large as the largest terminal size during the session; while the terminal is smaller, the unused area shows the background color.
  • GIF encoding: gif. Each frame stores only the changed area, and terminal colors are kept exact.

Install

  • Prebuilt binary: download the archive for GNU/Linux (x86_64, static, so it runs on any distribution) or Windows (x86_64) from the releases and put term2gif on your PATH.
  • With uv (PyPI package term2gif-rs, which contains the same binary): uv tool install term2gif-rs, or without installing: uvx --from term2gif-rs term2gif demo.gif.
  • With cargo: cargo binstall term2gif (downloads the prebuilt binary) or cargo install term2gif (builds it, needs Rust 1.86 or newer).

Windows needs Windows 10 version 1809 or newer (ConPTY).

Build

cargo build --release      # needs Rust 1.86 or newer; binary: target/release/term2gif
cargo install --path .

Limitations

  • Keystrokes are not captured in the recording (output only).
  • Combining characters (e.g. a separate accent after a letter) are dropped by the virtual terminal; precomposed characters like ä work.
  • No ligatures or right-to-left text shaping; each character is drawn in its own cell, as in a terminal.

License

MIT, see LICENSE. The bundled DejaVu Sans Mono fonts are under the Bitstream Vera license, see fonts/DejaVu-LICENSE.txt. Dependencies are under MIT, Apache-2.0 or similar permissive licenses.

Metadata

Release files for term2gif-rs 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for term2gif-rs 0.1.0
File Size Uploaded
term2gif_rs-0.1.0.tar.gz 469.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for term2gif-rs 0.1.0
File Interpreter ABI Platform
term2gif_rs-0.1.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
term2gif_rs-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64, Linux musl 1.2+ x86-64 Details

Total release size: 3.7 MB

Release files / term2gif_rs-0.1.0.tar.gz

Download URL term2gif_rs-0.1.0.tar.gz
Size 469.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7fb72f2381ee0aabdb1a90fe173eaaf873f2f4bc71e943f8dbb595996807b850
BLAKE2b-256 checksum
How to use checksums
635b4d0d49a386d59a12e93fb0a8bd8dda02a76df4ea5fea6cb74da8f16d3c61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / term2gif_rs-0.1.0-py3-none-win_amd64.whl

Download URL term2gif_rs-0.1.0-py3-none-win_amd64.whl
Size 1.5 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
2b04ba656d9d8aecbd2b067fd6eb2081abb6e0ee6d4c1de5109b26997cbfc8d1
BLAKE2b-256 checksum
How to use checksums
f11cbaf77094dda075644ea196b06b8795eac8180424bd4b33a4545bc7c80a33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / term2gif_rs-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl

Download URL term2gif_rs-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl
Size 1.7 MB
Tags Linux glibc 2.17+ x86-64 Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
237e6c84579b23be46b8d088af9b8d0cb6c2bec09581cdd770c0eee66c745211
BLAKE2b-256 checksum
How to use checksums
9d85ceb01432808486f9eed55ecd983d125d2162f11aa51e7ffa4cab2ce48f39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page