8000 GitHub - sebszyller/ascii-rs
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

sebszyller/ascii-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ascii-rs

ascii-rs allows you to generate high resolution ascii art based on character weight, and resulting semantics.

It aims to speed up the manual and low resolution process. Without relying purely on colour and negative space information like many shader-based solutions.

tom

🛠️ Usage

Just git clone and cargo build however you want.

Invoke help with ascii-rs -h:

Usage: ascii-rs [OPTIONS] <IMAGE_PATH>

Arguments:
  <IMAGE_PATH>

Options:
      --width <MAX_WIDTH>
      --height <MAX_HEIGHT>
      --light-chars <LIGHT_CHARS>                       [default: ?%#@]
      --medium-chars <MEDIUM_CHARS>                     [default: DOS]
      --dark-chars <DARK_CHARS>                         [default: .,]
      --edge-chars <EDGE_CHARS>                         [default: /\]
      --luma-threshold-mid <LUMINANCE_THRESHOLD_MID>    [default: 50]
      --luma-threshold-high <LUMINANCE_THRESHOLD_HIGH>  [default: 95]
      --canny-threshold-low <CANNY_THRESHOLD_LOW>       [default: 10]
      --canny-threshold-high <CANNY_THRESHOLD_HIGH>     [default: 50]
      --no-colour
      --output-edges
      --seed <SEED>                                     [default: 1234567890]
  -h, --help                                            Print help

💡 Tips

🚨Does your ascii art have weird dimensions?

Not all typefaces and line settings work well for ascii art.

All examples in this repo are generated with:

  • font size < 8;
  • alacritty line offset offset = { x = 0, y = -11 };
  • Courier New typeface.

These are not my usual terminal settings.

🚨Thresholding is fiddly.

It's quite difficult to find edge and luma thresholds that work across various images. For best results, you need to experiment with different values. Pass --output-edges to inspect the Canny algorithm output.

🚨It's slow

While ascii conversion is fast, Canny can take quite long. Your typical terminal is going to be < 500 characters wide. There's no point processing images larger than that.

See recipes.

📜 Recipes

cargo run -- test_inputs/godfather.jpg --width=200 --luma-threshold-mid 100 --luma-threshold-high 175 --no-colour

cargo run -- test_inputs/godfather.jpg --width=200 --luma-threshold-mid 100 --luma-threshold-high 175

godfather_bw godfather

cargo run -- test_inputs/nyc.jpg --width 250 --luma-threshold-mid 50 --luma-threshold-high 170 --no-colour

cargo run -- test_inputs/nyc.jpg --width 250 --luma-threshold-mid 50 --luma-threshold-high 170

nyc_bw nyc

cargo run -- test_inputs/tom.jpg --width=150 --luma-threshold-mid 100 --luma-threshold-high 175

cargo run -- test_inputs/tom.jpg --width=150 --luma-threshold-mid 100 --luma-threshold-high 175 --no-colour

tom_bw tom

🚀 Feature milestones

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0