insa 1.0.0

Insa renders imaxes to text - it's a terminal bitmap graphics library
Documentation
  • Coverage
  • 66.67%
    20 out of 30 items documented2 out of 26 items with examples
  • Size
  • Source code size: 12.37 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.35 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 43s Average build duration of successful builds.
  • all releases: 43s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • BrightOpen/insa
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jocutajar

Insa

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.

original

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 {
        println!("\x1b[0m");
    }
    print!("{symbol}");
}
println!("\x1b[0m");

Features

The fontdue feature enables rasterization.

License

MIT with exceptions