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 imageWidthfor image. -
Run:
tapciify -i imagePath -w imageWidth -rfor 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 badapple.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/original.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 image::imageops::FilterType;
use tapciify::{
AsciiArtConverter, AsciiArtConverterOptions, CustomRatioResize, DEFAULT_FONT_RATIO,
};
let img = image::open("./assets/examples/original.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§
- Utils for converting your images to ASCII
- Converting images to ASCII art using Braille characters
- Utils used in tapciify CLI
- Utils for playing multiple frames. Probably you only need to use that if you are creating a CLI
- Utils for resizing your images, but including your font ratio
Structs§
- Raw ASCII art conversion result
- Options for converter of images to ASCII art
- ASCII pixel of
AsciiArt - Player to convert and play frames
- Options of player to convert and play frames
- Error caused by lightness being out of ASCII string in
ascii_character - Error caused by too small image sizes
Enums§
- Error caused by
AsciiArtConverter - Error caused by
AsciiPlayer
Constants§
- Default ASCII string, feel free to use your one
- Consolas font family aspect ratio
Traits§
- Converter of images to ASCII art
- Trait for resizing images and counting in font ratio
- Just a small util for reversing
String - Trait for converting pixels into
AsciiArtPixel
Functions§
- Convert lightness of pixel to
char