PNG to ANSI Text Converter
Convert images to ANSI escape codes for terminal banners. Supports TrueColor, xterm-256, and custom ASCII character sets. 100% Client-side.
Drag & Drop Image or Click to Upload
PNG, JPG, WEBP supported
About
Terminal interfaces often lack visual flair. The PNG to ANSI Converter bridges the gap between high-fidelity graphics and the text-based console environment. By mapping image pixels to standard ANSI escape sequences, developers can embed logos, diagrams, or artistic headers directly into CLI tools, logs, and MOTD (Message of the Day) scripts.
This tool addresses the fundamental mismatch between square pixels and non-square terminal characters by applying an algorithmic Aspect Ratio Correction. It scans the source image, calculates the perceived luminance of every sector, and assigns a corresponding ASCII character based on density. Simultaneously, it computes the nearest color value - supporting both modern TrueColor (24-bit) and legacy xterm-256 (8-bit) standards - to ensure your banner looks crisp on any terminal emulator.
Formulas
The core transformation relies on calculating the luminance Y of each pixel to determine which ASCII character best represents that density.
To map RGB values to the xterm-256 6x6x6 color cube, we quantize the channels into 6 levels (0-5) and calculate the index I:
where r, g, b are normalized to the range [0, 5].
Reference Data
| Standard | Escape Sequence Format | Support Level | Color Depth |
|---|---|---|---|
| ASCII (Plain) | None | Universal | 1-bit (Monochrome) |
| ANSI 16 | \x1b[30m - \x1b[37m | Legacy / Basic | 4-bit (16 Colors) |
| xterm-256 | \x1b[38;5;{ID}m | High (Most Terminals) | 8-bit (256 Colors) |
| TrueColor | \x1b[38;2;{R};{G};{B}m | Modern (VSCode, iTerm2) | 24-bit (16M Colors) |
| Reset Code | \x1b[0m | Universal | N/A |