Crate insa

source ·
Expand description


insa version on

Insa converts raster bitmap images to text / ansi escapes. Why? Shape detection and matching appropriate glyph, rather than just luminosity => char. Let terminal based apps show some basic graphics, too - mail, chat, file browser…

This is a cargo lib insa and also a command line tool insa and insa-rasterize

The original of 400px width is converted to 50 chars. One character takes 8px width and 16px height.


insa docs/insa.jpeg

insa blocks

insa --style plain docs/insa.jpeg

insa blocks

Notice how the blocks (default) style brings perhaps double the precision and fidelity with the same amount of characters as it detects sub-block shapes.

You can supply your own brushes to make ascii art, too, with the lib. For example:

logo original

insa --style simple-on-dark docs/logo.png

logo ascii art

Tool usage

cargo install insa
insa --help
insa-rasterize --help

Lib usage

cargo add insa
let img = "docs/insa.jpeg";
let img = image::open(img).expect("opening the image");
let mut insa = insa::Insa::blocks();
for ((col, row), symbol) in insa.convert(&img) {
    if col == 0 && row != 0 {


The fontdue feature enables rasterization.


MIT with exceptions


The main interface to image to text converion


Rasterize a font character into a u128 bitmap. This is used for matching brushes.

Type Definitions