Paint anything as coloured ASCII.
~6 KB · ZERO DEPENDENCIESZERO DEPS · WEBGL2
Any image, video, canvas or three.js scene, painted in coloured glyphs. Move across the picture above to resolve it.
Install
01 INSTALL
$ npm i asciipaint02 PAINT
import { asciipaint } from "asciipaint"
;
const paint = asciipaint(canvas);
paint.draw(picture);03 PLAYGROUND
Drop your own picture onto the stage. It is painted on your machine and never uploaded.
— × — CELLS
SOURCE
RAMP DARK → BRIGHT
BACKGROUND
SPARKLE
YOUR SETTINGSupdates as you drag
import { asciipaint, autoRender } from "asciipaint";
const paint = asciipaint(canvas, { cell: [2.4, 3.4], ramp: "-=+*#%@", background: "#000000", sparkle: true });
autoRender(paint, () => paint.draw(sketch));04 ONE TAG
Import the element once, then use it like <img>. Every <ascii-img> on the page shares one WebGL context, so a whole wall of them costs one GPU setup.
orbit.svgSVG
chevrons.pngPNG
petals.svgSVG
hex.pngPNG
tide.svgSVG
moon.pngPNG
diamonds.svgSVG
dawn.pngPNG
leaf.svgSVG
steps.pngPNG
cross.svgSVG
nest.pngPNG
LOGOS.HTML
import "asciipaint/element";
<ascii-img src="orbit.svg"></ascii-img>
<ascii-img src="chevrons.png"></ascii-img>- SVG with only a viewBox, or a transparent PNG
- Transparent pixels stay paper
- One shared WebGL context for every tag
- Fires paint and error events, like <img>
05 THREE.JS
Swap renderer.render for pass.render. Same scene, same camera, painted in the same frame.
pass.render(scene, camera)
SCENE.TS
import { asciipaintThree }
from "asciipaint/three";
const pass = asciipaintThree(renderer);
pass.render(scene, camera);Graded with ACES Filmic and output as sRGB, so lit scenes keep their highlights.