1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 |
htmlansi
========
Convert images to CP437 ANSI art (HTML or .ans).
Requires Node.js >= 20.
Build
-----
npm install
npm run build
Usage
-----
node dist/cli.js <image> -o out.html
node dist/cli.js <image> -f ans -c ansi256 -o out.ans
node dist/cli.js <image> --preview
node dist/cli.js --in ./in --out ./out
Options
-------
-f, --format html | ans (default html)
-m, --mode glyph | half-block | braille (default glyph)
--glyphs safe | full (default safe)
-w, --width columns (default 80)
--height rows
-c, --colors ansi16 | ansi256 | truecolor (default ansi256)
-d, --dither none | floyd-steinberg | atkinson (default none)
--bg #rrggbb or r,g,b (default #000000)
--max-width n (default 200)
--no-clamp
--brightness --contrast --gamma --saturation
--invert
--preview
Modes
-----
glyph coverage matching over a CP437 glyph set (default)
half-block two vertical pixels per cell
braille 2x4 dots per cell
Use -c truecolor for smooth gradients; ansi16/ansi256 band.
The default glyph set (safe) keeps rows aligned in any monospace font;
--glyphs full adds eighth-blocks and quadrants (needs a font that renders
them monospaced).
Library
-------
import { convert, convertToFormat } from 'htmlansi';
const result = await convert('img.png', { mode: 'glyph', width: 100 });
const html = await convertToFormat('img.png', 'html');
See docs/guide.md and docs/algorithms.md for details.
MIT - runv.sh - https://runv.sh
|