ASCII to JPG Converter
Convert ASCII text and ASCII art to high-quality JPG images with customizable fonts, colors, sizing, and JPEG quality settings.
About
ASCII art and plain text lack portability. Pasting monospaced characters into a chat, email, or document risks font substitution, line-wrap corruption, and whitespace collapse. A single wrong font renders hours of careful spacing meaningless. This tool performs real pixel-level rendering through the Canvas API: each character is measured via measureText, placed at exact coordinates, and exported as a true JPEG bitmap at configurable quality Q ∈ [0.1, 1.0]. The output is a standalone image file that preserves spatial fidelity regardless of the viewer's installed fonts.
The converter assumes a monospaced typeface to maintain column alignment. Variable-width fonts are available but will distort grid-based ASCII art. JPEG compression introduces lossy artifacts around sharp text edges. For lossless output, set quality to 1.0 (minimal compression). Note: extremely large inputs (> 10,000 lines) may hit browser canvas size limits, which vary by device and browser engine.
Formulas
The canvas dimensions are computed from the input text properties and rendering configuration:
where W = canvas width in pixels, H = canvas height in pixels, N = number of text lines, fontSize = selected font size in px, lineHeight = dimensionless multiplier, and padding = border padding in px.
Each line linei is drawn at position:
The JPEG encoding uses the native Canvas method toBlob(callback, "image/jpeg", Q) where Q ∈ [0, 1] controls the DCT quantization table scaling factor. At Q = 1.0, the quantization matrix approaches identity, preserving maximum detail.
Reference Data
| Parameter | Default | Range | Effect on Output |
|---|---|---|---|
| Font Size | 14px | 8 - 72px | Directly scales canvas dimensions and character resolution |
| Line Height | 1.4 | 1.0 - 2.5 | Multiplier on font size for vertical spacing between lines |
| Padding | 20px | 0 - 100px | Whitespace border around rendered text |
| JPEG Quality | 0.92 | 0.1 - 1.0 | Higher values reduce compression artifacts but increase file size |
| Font: Courier New | Monospaced | - | Best for ASCII art; preserves column alignment |
| Font: Consolas | Monospaced | - | Slightly narrower than Courier; modern appearance |
| Font: Lucida Console | Monospaced | - | Wider character spacing; high readability |
| Font: Monaco | Monospaced | - | macOS native monospace; compact |
| Font: Arial | Variable-width | - | Will break ASCII art grid alignment |
| Font: Georgia | Variable-width (Serif) | - | Serif rendering; not recommended for art |
| Canvas Max Width | Browser-dependent | ~16384px | Chrome/Firefox limit; exceeding causes blank output |
| Canvas Max Height | Browser-dependent | ~16384px | Same as width; total pixel count also capped |
| Canvas Max Area | Browser-dependent | ~268Mpx | Chrome ~268M, Safari ~67M, Firefox ~472M |
| JPEG at Q=0.1 | - | - | ~5 - 15KB per 100 lines; heavy artifacts |
| JPEG at Q=0.5 | - | - | ~20 - 60KB per 100 lines; acceptable quality |
| JPEG at Q=1.0 | - | - | ~80 - 200KB per 100 lines; near-lossless |