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§
- Utils for converting your images to ASCII
- Use text for background on light pixels
- Converting images to ASCII art using Braille characters
- Utils used in tapciify CLI
- Just macros
- 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
- Utils used in
crate::background_string
andcrate::braille
Macros§
- Macro for joining multiple iterators
Structs§
- Raw
AsciiArtConverter
result - Options for
AsciiArtConverter::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§
- Convert image into
AsciiArt
- Trait for resizing images and counting in font ratio
- ReverseStringDeprecatedJust a small util for reversing
String
- Trait for converting pixels into
AsciiArtPixel
Functions§
- Convert lightness of pixel to
char