Expand description
Tool to convert your images into ASCII art
Useful functions, when using as lib
§Installation
cargo install tapciify
§Converting image
-
Run:
tapciify -i imagePath -w imageWidth
for image. -
Run:
tapciify -i imagePath -w imageWidth -r
for reversed colors.
§Converting video
In this example I set framerate to 24 (but you can use any another)
Requires ffmpeg
-
Make frames from video into dir:
mkdir frames; ffmpeg -i bad_apple.mkv frames/%08d.jpeg
-
Run:
tapciify -i frames/* -w videoWidth -f 24
§Examples
Demo:
use image::imageops::FilterType;
use tapciify::{
AsciiArtConverter, AsciiArtConverterOptions, CustomRatioResize, DEFAULT_FONT_RATIO,
};
let img = image::open("./assets/examples/ferris.webp")?;
let result = img
.resize_custom_ratio(Some(64), None, DEFAULT_FONT_RATIO, FilterType::Triangle)
.ascii_art(&AsciiArtConverterOptions {
// Put your other options here
..Default::default()
})?;
println!("{}", result);
Colored:
use std::error::Error;
use tapciify::{
AsciiArtConverter, AsciiArtConverterOptions, CustomRatioResize, DEFAULT_FONT_RATIO,
};
let img = image::open("./assets/examples/ferris.webp")?;
let result = img
.resize_custom_ratio(Some(64), None, DEFAULT_FONT_RATIO, FilterType::Triangle)
.ascii_art(&AsciiArtConverterOptions {
// Put your other options here
colored: true,
..Default::default()
})?;
println!("{}", result);
Modules§
- ascii
- Utils for converting your images to ASCII
- background_
string - Use text for background on light pixels
- braille
- Converting images to ASCII art using Braille characters
- cli
- Utils used in tapciify CLI
- macros
- Just macros
- player
- Utils for playing multiple frames. Probably you only need to use that if you are creating a CLI
- resize
- Utils for resizing your images, but including your font ratio
- threshold_
utils - Utils used in
crate::background_string
andcrate::braille
Macros§
- product
- Macro for joining multiple iterators
Structs§
- Ascii
Art - Raw
AsciiArtConverter
result - Ascii
ArtConverter Options - Options for
AsciiArtConverter::ascii_art
- Ascii
ArtPixel - ASCII pixel of
AsciiArt
- Ascii
Player - Player to convert and play frames
- Ascii
Player Options - Options of player to convert and play frames
- Ascii
String Error - Error caused by lightness being out of ASCII string in
ascii_character
- Size
Error - Error caused by too small image sizes
Enums§
- Ascii
ArtConverter Error - Error caused by
AsciiArtConverter
- Ascii
Player Error - Error caused by
AsciiPlayer
Constants§
- DEFAULT_
ASCII_ STRING - Default ASCII string, feel free to use your one
- DEFAULT_
FONT_ RATIO - Consolas font family aspect ratio
Traits§
- Ascii
ArtConverter - Convert image into
AsciiArt
- Custom
Ratio Resize - Trait for resizing images and counting in font ratio
- Reverse
String Deprecated - Just a small util for reversing
String
- ToAscii
ArtPixel - Trait for converting pixels into
AsciiArtPixel
Functions§
- ascii_
character - Convert lightness of pixel to
char