Crate tapciify

Source
Expand description

Tool to convert your images into ASCII art

Useful functions, when using as lib

§Installation

cargo install tapciify

§Converting image

  1. Run: tapciify -i imagePath -w imageWidth for image.

  2. 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

  1. Make frames from video into dir:

    mkdir frames; ffmpeg -i bad_apple.mkv frames/%08d.jpeg
  2. 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 and crate::braille

Macros§

product
Macro for joining multiple iterators

Structs§

AsciiArt
Raw AsciiArtConverter result
AsciiArtConverterOptions
Options for AsciiArtConverter::ascii_art
AsciiArtPixel
ASCII pixel of AsciiArt
AsciiPlayer
Player to convert and play frames
AsciiPlayerOptions
Options of player to convert and play frames
AsciiStringError
Error caused by lightness being out of ASCII string in ascii_character
SizeError
Error caused by too small image sizes

Enums§

AsciiArtConverterError
Error caused by AsciiArtConverter
AsciiPlayerError
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§

AsciiArtConverter
Convert image into AsciiArt
CustomRatioResize
Trait for resizing images and counting in font ratio
ReverseStringDeprecated
Just a small util for reversing String
ToAsciiArtPixel
Trait for converting pixels into AsciiArtPixel

Functions§

ascii_character
Convert lightness of pixel to char