User Rating 0.0
Total Usage 0 times
Drop .ans / .txt file here or click to browse
Examples:
Preview will appear here
Is this tool helpful?

Your feedback helps us improve.

About

ANSI art encodes visual data through escape sequences defined in ECMA-48 (ISO/IEC 6429). A misinterpreted SGR parameter - say, confusing 38;5;n (256-color foreground) with 48;5;n (background) - renders the entire piece incorrectly. This converter parses raw ANSI text, builds a cell grid of dimensions cols × rows, and rasterizes each cell onto a Canvas at a configurable font size. The resulting pixel buffer is then quantized to 256 colors via median-cut and encoded into a GIF89a binary stream with LZW compression. No server round-trip occurs. The tool approximates standard VGA terminal rendering assuming a CP437-compatible monospace font and a fixed 80-column width. Blink attributes produce a two-frame animation. Color accuracy depends on your display calibration against the canonical CGA/EGA/VGA palette.

ansi art gif converter ansi to gif ascii art ansi escape codes gif encoder terminal art

Formulas

The converter rasterizes each ANSI cell onto a bitmap of total size:

W = cols × charWidth , H = rows × charHeight

where cols defaults to 80 and charWidth, charHeight derive from the rendered font metrics. The GIF89a stream uses LZW variable-length coding. Initial code size:

minCodeSize = max(2, ceil(log2(paletteSize)))

where paletteSize 256 is determined by median-cut quantization. Each frame includes a Graphic Control Extension specifying disposal method and delay:

delay = interval10 centiseconds

where interval is the user-configured millisecond delay between frames. For blink animation, two frames alternate: one with blinking characters visible, one with them hidden (background-only). The Netscape Application Extension block sets loop count to 0 (infinite).

Reference Data

SGR CodeEffectTypical Rendering
0Reset / NormalAll attributes off
1Bold / BrightIncreased intensity or bright color variant
5Slow BlinkToggles visibility at < 150 bpm
7Reverse VideoSwap foreground and background
30 - 37Set foreground (standard)Black, Red, Green, Yellow, Blue, Magenta, Cyan, White
40 - 47Set background (standard)Same 8 colors as background
90 - 97Set foreground (bright)Bright variants of standard 8
100 - 107Set background (bright)Bright variants as background
38;5;n256-color foregroundn [0, 255]
48;5;n256-color backgroundn [0, 255]
38;2;r;g;b24-bit truecolor foregroundDirect RGB specification
48;2;r;g;b24-bit truecolor backgroundDirect RGB specification
ESC[nACursor UpMove cursor up n rows
ESC[nBCursor DownMove cursor down n rows
ESC[nCCursor ForwardMove cursor right n columns
ESC[nDCursor BackMove cursor left n columns
ESC[r;cHCursor PositionMove to row r, column c
ESC[2JErase DisplayClear entire screen
ESC[KErase in LineClear from cursor to end of line
GIF89a LZWMin code sizePalette bits, typically 2 - 8
GIF Frame DelayIn 1/100 sValue 50 = 500 ms

Frequently Asked Questions

The parser supports ECMA-48 / ISO 6429 CSI (Control Sequence Introducer) sequences including SGR (Select Graphic Rendition) codes 0-49 and 90-107, 256-color mode (38;5;n / 48;5;n), 24-bit truecolor (38;2;r;g;b / 48;2;r;g;b), and cursor movement commands (CUU, CUD, CUF, CUB, CUP). It does not handle OSC (Operating System Command) sequences or terminal-specific private modes.
GIF format is limited to 256 colors per frame. When your ANSI art uses more unique colors (common with 24-bit truecolor sequences), the median-cut quantization algorithm reduces the palette. This may shift subtle gradients. For best fidelity, use ANSI art that stays within the standard 256-color xterm palette. The quantization error is typically under ΔE 3.0 in CIELAB space.
SGR code 5 (slow blink) marks cells as blinking. The converter generates two frames: Frame 1 renders all characters normally; Frame 2 replaces blinking cells with their background color only (character hidden). These two frames alternate at the user-specified delay interval, typically 500ms per frame, producing the classic terminal blink effect as a looping GIF.
The practical limit is governed by Canvas memory. At 80 columns with an 8×16 pixel font, a 500-row ANSI produces a 640×8000 pixel image - roughly 20MB of raw pixel data per frame. Most browsers handle this without issue. Beyond 1000 rows or at larger font sizes, you may encounter canvas allocation failures. The GIF encoder processes in chunks to manage memory.
The tool supports splitting input by a configurable delimiter (default: form-feed character \f, ASCII 12). Each segment becomes a separate GIF frame. If your animation uses a different separator, enter it in the Frame Delimiter field. Each frame is independently parsed and rendered, so cursor state resets between frames.
ANSI art contains large regions of uniform color (backgrounds) and repeated character patterns. LZW compression exploits this repetition efficiently. A typical 80×25 ANSI screen at 8×16 font produces 128,000 pixels. Without LZW, the raw indexed data would be 128KB per frame. With LZW, this typically compresses to 15-40KB depending on complexity, making the GIF 3-8× smaller than the uncompressed bitmap.