asc-eye 1.1
Image patch → ASCII glyph. A small CNN maps each 8×16 cell (from a 24×16 window) to one character from a VGA 8×16 glyph bank.
| Model | Checkpoint | Charset | K |
|---|---|---|---|
| ascii-plain | models/ascii-plain.pt |
printable ASCII 0x20–0x7E |
95 |
| ascii-extended | models/ascii-extended.pt |
full CP437 (blank-deduped) | 254 |
Inference-only package: stills + video, optional per-cell color, optional --fit_source (encode dense, then scale frames back to the source WxH).
Demo — 2× color → 1920×1080
ascii-plain
ascii-extended
ascii-plain (greyscale)
Scaling (synced to 1920×1080)
Glyph cell = 8×16 px. For a 1080p frame:
| Scale | --width_cells |
Encode canvas | After --fit_source |
|---|---|---|---|
| 1× | 240 (= 1920/8) | 1920×1072 | 1920×1080 |
| 2× | 480 (= 1920×2/8) | 3840×2160 | 1920×1080 |
Height is round(H × width_cells×8 / W) snapped down to a multiple of 16. Always pass --fit_source on video if you want the muxed file to match the input resolution.
Promo examples in this release were encoded at 2× (width_cells=480) + --fit_source.
Contents
| Path | Role |
|---|---|
models/ascii-plain.pt |
Plain ASCII weights |
models/ascii-extended.pt |
Extended (CP437) weights |
config.json |
Package / scaling / model metadata |
assets/VGA8.F16 |
VGA 8×16 font ROM |
asc_eye/ |
Model, glyph bank, preprocess, encode helpers |
encode_image.py / encode_video.py |
CLIs |
examples/promo_ascii-plain_2x_color.mp4 |
Plain, 2× color → 1080p |
examples/promo_ascii-plain_2x_bw.mp4 |
Plain, 2× greyscale → 1080p |
examples/promo_ascii-extended_2x_color.mp4 |
Extended, 2× color → 1080p |
examples/splash_logo.{png,txt} |
Color ASCII splash |
Install
pip install -r requirements.txt
# video path also needs ffmpeg on PATH
Quick start — image
# plain ASCII, ~1× relative to 1080p width
python encode_image.py \
--image your.png \
--ckpt models/ascii-plain.pt \
--font assets/VGA8.F16 \
--charset ascii \
--width_cells 240 \
--out_png out.png \
--out_txt out.txt \
--color
# extended CP437
python encode_image.py \
--image your.png \
--ckpt models/ascii-extended.pt \
--font assets/VGA8.F16 \
--charset cp437 \
--width_cells 240 \
--out_png out.png \
--color
--width_cells— glyph columns (use 240 / 480 for 1× / 2× at 1080p).--color— tint each glyph by mean RGB of its cell (HSV sat boost),out = glyph × coloron black.--scale— nearest-neighbor upscale of the blit PNG only (does not change glyph count).
Quick start — video (2× + fit to source)
python encode_video.py \
--video your_1080p.mp4 \
--ckpt models/ascii-plain.pt \
--font assets/VGA8.F16 \
--charset ascii \
--width_cells 480 \
--color \
--fit_source \
--out_mp4 out.mp4
| Flag | Meaning |
|---|---|
--width_cells 480 |
Native 2× at 1080p |
--width_cells 240 |
Native 1× at 1080p |
--color |
Per-cell mean-RGB tint |
--fit_source |
LANCZOS each ASCII frame to source WxH, then mux |
--keep_frames |
Keep work dir |
Omit --color for greyscale. Audio from the source is remuxed when present.
Python API sketch
from pathlib import Path
import torch
from PIL import Image
from asc_eye.glyph_bank import GlyphBank
from asc_eye.model import PatchToGlyph
from asc_eye.encode_image import prepare_luma_rgb, cell_mean_colors, encode, render_ascii_png
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
bank = GlyphBank("assets/VGA8.F16", charset="ascii").to(device) # or charset="cp437"
ckpt = torch.load("models/ascii-plain.pt", map_location=device, weights_only=False)
model = PatchToGlyph(bank.K).to(device)
model.load_state_dict(ckpt["model"])
model.eval()
img = Image.open("your.png")
y, rgb = prepare_luma_rgb(img, width_cells=240)
lines, indices = encode(model, bank, y, device)
colors = cell_mean_colors(rgb)
Path("out.txt").write_text("\n".join(lines) + "\n", encoding="utf-8")
render_ascii_png(indices, bank, Path("out.png"), scale=1, colors=colors)
How scaling works
- Luma (and RGB if coloring) is tone-stretched and resized to
width_cells × 8wide; height snapped to a multiple of 16. - Each cell is encoded from its 24×16 window.
- Glyphs are blitted (greyscale or color-tinted).
--fit_sourceresizes those frames back to the original video dimensions.
How coloring works
- Mean RGB of each cell.
- Mild HSV saturation boost (
×1.35+ small lift). glyph × coloron black.
Changelog — 1.1
- Dual models: ascii-plain and ascii-extended (replacing informal v1 / v2 names).
- Documented native 1×/2× for 1920×1080 (
width_cells240 / 480) with--fit_source. - New promo examples at true 2× (replaced prior under-resolved “2×” clip).
License
MIT.
Contact
- Tim Cotten — tcotten@scrypted.ai
- Andrew Woodruff — awoodruff@scrypted.ai
- Downloads last month
- 66