#image #graphics #threshold #convert-images #ansinator #manual #otsu

ansinator_image_binarize

A library binarize images by manual threshold and otsu's method

1 unstable release

0.1.0 Sep 16, 2022

#775 in Graphics APIs

24 downloads per month
Used in 2 crates (via ansinator_ansi_image)

MIT license

6KB
76 lines

github crates

Ansinator is a collection of CLI programs to convert images to various character representation with support for ANSI escape code sequence

Installation

Cargo:

You can install the binary crate directly

cargo install ansinator 

Manual Installation:

you can clone ansinator repo and build it locally

git clone https://github.com/dax99993/ansinator
cd ansinator 
cargo install --path .

Programs

  • Ascii
  • Block
  • Braile 8-dot
  • Uniblock (sextant)

Todo

  • Best fitting ascii character analysis
  • Simple animation

License

MIT

Compatibility

This application was design to work in any unicode terminal but the result might look different depending on the terminal font and settings. Testing has been performed only on Alacritty, Kitty, ST and rxvt-unicode, using the JetBrains Mono font.

Ascii

Probably will work for all terminals

  • Alacritty working
  • Kitty working
  • ST working
  • rxvt-unicode working except for truecolor, use terminalcolor instead

Braile

Probably will work on all terminals supporting Unicode Glyphs

  • Alacritty working
  • Kitty working
  • ST working
  • rxvt-unicode working

Block

Probably will work on all terminals supporting Unicode Glyphs

  • Alacritty working
  • Kitty working
  • ST working
  • rxvt-unicode working except for truecolor, use terminalcolor instead

Uniblock

Probably will work on all terminals supporting Unicode Glyphs, but it also depends on the way the terminal handles sextant characters.

  • Alacritty working but might look weird depending on the x,y character offset and the font
  • Kitty working
  • ST working but might look weird depending on the x,y character offset and the font
  • rxvt-unicode not working missing sextant characters (might be a misconfiguration of my part of the fonts)

Bugs

If find any bug or weird behaviour send an email to dax99993@gmail.com

Log

  • 0.2.3 Fixed bug in fixed background color for ascii, braile and uniblock, also fixed background color extension to end of line on some terminals.
  • 0.2.2 Fixed convertion in braile and block, and fixed resizing.
  • 0.2.1 added both GRADIENT mode with PATTERN mode in ascii, and change help message and flags.
  • 0.2.0 replace GRADIENT mode with PATTERN mode in ascii.
  • 0.1.1 Uniblock convertion added, and extra options as fixed foreground and background
  • 0.1.0 Basic ascii, braile, block

lib.rs:

GrayImage Threshold Trait.

Provide the Threshold Trait for GrayImage, implementing:

  • Otsu's binarization threshold
  • Manual binarization threshold
  • Image pixel invertion

Dependencies

~13MB
~59K SLoC