ASCII to GIF Converter
Convert ASCII art text frames into animated GIF images. Customize colors, font size, speed, and canvas size. Pure client-side GIF encoder.
About
Animated GIF files encode frame sequences using the GIF89a binary specification with LZW compression. Manual conversion from ASCII art to GIF demands precise color quantization, correct sub-block packaging, and proper Graphic Control Extension headers for frame timing. A single misaligned byte in the LZW stream corrupts the entire output. This tool renders each ASCII text frame onto an HTML Canvas, extracts raw pixel data, quantizes colors to a 256-color palette, applies LZW compression per frame, and assembles a standards-compliant GIF89a binary. All encoding runs client-side in a Web Worker. No server uploads. No data leaves your browser.
Frame delay is specified in centiseconds (1 cs = 10 ms). The minimum reliable delay across browsers is approximately 2 cs (20 ms); values below this are clamped by most renderers to ~10 cs. Note: this tool approximates font rendering via the Canvas fillText API, which may produce slight glyph differences compared to terminal emulators depending on OS font availability.
Formulas
The GIF file format uses LZW (Lempel-Ziv-Welch) compression to encode indexed pixel data. Each pixel maps to an index in a color table of at most 256 entries. The LZW algorithm builds a dictionary of pixel sequences, replacing repeated patterns with shorter codes.
The clear code is 2min_code_size and end-of-information code is 2min_code_size + 1. Dictionary entries start at index 2min_code_size + 2. When the dictionary reaches 212 = 4096 entries, a clear code resets it.
Where delaycs is the Graphic Control Extension delay value in centiseconds. The total animation duration is:
Where N = number of frames, delayi = delay of frame i in centiseconds. Color quantization maps 24-bit RGB pixels to the nearest palette entry using Euclidean distance in RGB space:
Reference Data
| Parameter | Default | Range | Description |
|---|---|---|---|
| Frame Delay | 50 cs | 2 - 1000 cs | Pause between frames (100 cs = 1 s) |
| Font Size | 16 px | 8 - 72 px | Monospace font size for rendering |
| Canvas Width | 480 px | 64 - 1920 px | Output image width in pixels |
| Canvas Height | 320 px | 64 - 1080 px | Output image height in pixels |
| Text Color | #00FF00 | Any hex | Foreground color for ASCII characters |
| Background Color | #000000 | Any hex | Canvas background fill |
| Loop Count | 0 | 0 - 65535 | 0 = infinite loop |
| Frame Separator | === | Any string | Delimiter between ASCII frames |
| Max Color Table | 256 | 2 - 256 | GIF global color table size |
| LZW Min Code Size | 8 bits | 2 - 8 bits | Initial LZW dictionary bit width |
| Disposal Method | 2 | 0 - 3 | 0=none, 1=keep, 2=restore bg, 3=restore prev |
| GIF89a Header | GIF89a | - | Required 6-byte signature for animated GIF |
| NETSCAPE2.0 | App Extension | - | Application extension block enabling animation looping |
| Max Frames | 100 | 1 - 100 | Safety limit to prevent memory exhaustion |
| Max File Size | ~50 MB | - | Practical browser memory limit for Blob creation |