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 --locked term2gif (builds it, needs Rust 1.86 or newer).

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

Build

With Rust 1.86 or newer, straight from GitHub:

cargo install --locked --git https://github.com/sbellon/term2gif

or from a local checkout:

cargo install --locked --path .

Either installs term2gif into ~/.cargo/bin. Or build it with cargo build --release and put target/release/term2gif (term2gif.exe on Windows) on your PATH yourself.

Checks

The typical Rust flow must stay clean (clippy runs with the pedantic group enabled via [lints.clippy] in Cargo.toml):

cargo fmt --check
cargo check --all-targets --all-features
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
cargo doc --no-deps --all-features

plus a clippy pass for the other platform's code via a cross target (x86_64-pc-windows-msvc from GNU/Linux, x86_64-unknown-linux-musl from Windows), e.g.:

cargo clippy --all-targets --all-features --target x86_64-pc-windows-msvc -- -D warnings

A pre-commit hook runs all of it automatically; enable it once per clone with:

git config core.hooksPath .githooks

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.1

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.1
File Size Uploaded Provenance
term2gif_rs-0.1.1.tar.gz 471.2 kB With provenance Details

Built distributions (wheels)

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

Total release size: 3.7 MB

Release files / term2gif_rs-0.1.1.tar.gz

Download URL term2gif_rs-0.1.1.tar.gz
Size 471.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e05c78532b68d0717f3e50c6a57e29b191923c3cd4aa57326073f7fa7a6dfcbc
BLAKE2b-256 checksum
How to use checksums
44fe7c9bd0f485ed1f6a4262708abd29158c60698f5df89c71d3ef292834e469
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 20, 2026.

Transparency log

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

Download URL term2gif_rs-0.1.1-py3-none-win_amd64.whl
Size 1.5 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
6f81bb5d2aa7d51eece34a211081310ab78e46a1e300cc8183eab542edc4e414
BLAKE2b-256 checksum
How to use checksums
32b1bb393bd566121141bba5b1a8d6c32c9b13950c9520239445b8045dfb454f
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 20, 2026.

Transparency log

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

Download URL term2gif_rs-0.1.1-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
46ee17fd9469e0afef597e74c4e4915fba386441b8043f8ce2b4f493b01989cf
BLAKE2b-256 checksum
How to use checksums
a8b8a5ed6522eac970ef1050e332e50bc33a6ecc976a6ed12380c1abac14189b
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 20, 2026.

Transparency log

Security for term2gif-rs 0.1.1

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.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for term2gif_rs-0.1.1.tar.gz

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 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

3 release files Full provenance

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