| Crates.io | cascii |
| lib.rs | cascii |
| version | 0.6.0 |
| created_at | 2025-12-28 20:04:44.508645+00 |
| updated_at | 2026-01-25 20:18:41.492643+00 |
| description | High-performance ASCII art generator for images and videos |
| homepage | https://github.com/cascii/cascii |
| repository | https://github.com/cascii/cascii |
| max_upload_size | |
| id | 2009329 |
| size | 103,216 |
cascii is a high-performance, interactive tool for converting videos and image sequences into ASCII art frames.
New: cascii can now be used as both a CLI tool and a Rust library!
When converting a video, the output files will be placed in a directory named after the video file. For example, cascii my_video.mp4 will create a my_video directory.
I recommend installing cascii-viewer to easily play any ascii animation generated
cascii will prompt you for them.ffmpeg for fast frame extraction and parallel processing with Rayon for ASCII conversion.--small and --large flags for quick quality adjustments.--default to run without prompts, using default values.An install.sh script is provided to build and install cascii to /usr/local/bin.
# Make sure you are in the cascii directory
./install.sh
You will be prompted for your password as it uses sudo to copy the binary.
Alternatively, install from crates.io (once published):
cargo install cascii
Add to your Cargo.toml:
[dependencies]
cascii = "0.1"
Run cascii without any arguments to be guided through the process:
cascii
It will first ask you to select an input file from the current directory, then prompt for the output directory, and finally for the quality settings.
You can also provide arguments directly:
# Basic usage with a video file
cascii my_video.mp4 --out ./my_frames
# Using presets
cascii my_video.mp4 --out ./my_frames --large
# Non-interactive mode (will fail if input is not provided)
cascii my_video.mp4 --out ./my_frames --default
# Convert a 5-second clip starting at 10 seconds into the video
cascii my_video.mp4 --start 00:00:10 --end 00:00:15
[input]: (Optional) The input video file or directory of images.
-o, --out: (Optional) The output directory. Defaults to the current directory.
--columns: (Optional) The width of the output ASCII art.
--fps: (Optional) The frames per second to extract from a video.
--font-ratio: (Optional) The aspect ratio of the font used for rendering.
--start: (Optional) The start time for video conversion (e.g., 00:01:23.456 or 83.456).
--end: (Optional) The end time for video conversion.
--default: Skips all prompts and uses default values for any missing arguments.
-s, --small: Uses smaller default values for quality settings.
-l, --large: Uses larger default values for quality settings.
-h, --help: Shows the help message.
-V, --version: Shows the version information.

settings:
Luminance: 1
Font Ratio: 0.7
Columns: 400

settings:
Luminance: 35
Font Ratio: 0.7
Columns: 400

settings:
Luminance: 35
Font Ratio: 0.5
Columns: 400

settings:
Luminance: 35
Font Ratio: 1
Columns: 400

Reconstituting a few seconds from the clip Aleph 2 by Max Cooper (around 2:30 to 3:00)
Frames: 960
Luminance: 30
Font Ratio: 0.7
Columns: 400
FPS: 30

cascii can be used as a Rust library in your own projects.
use cascii::{AsciiConverter, ConversionOptions};
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a converter with default configuration
let converter = AsciiConverter::new();
// Configure conversion options
let options = ConversionOptions::default()
.with_columns(200)
.with_font_ratio(0.7)
.with_luminance(20);
// Convert image to ASCII file
converter.convert_image(
Path::new("input.png"),
Path::new("output.txt"),
&options
)?;
Ok(())
}
use cascii::{AsciiConverter, ConversionOptions};
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let converter = AsciiConverter::new();
let options = ConversionOptions::default().with_columns(100);
// Get ASCII as a string without writing to file
let ascii_string = converter.image_to_string(
Path::new("input.png"),
&options
)?;
println!("{}", ascii_string);
Ok(())
}
use cascii::{AsciiConverter, VideoOptions, ConversionOptions};
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let converter = AsciiConverter::new();
// Video extraction options
let video_opts = VideoOptions {
fps: 30,
start: Some("0".to_string()),
end: Some("10".to_string()), // First 10 seconds
columns: 400,
};
// ASCII conversion options
let conv_opts = ConversionOptions::default()
.with_font_ratio(0.7)
.with_luminance(20);
// Convert video
converter.convert_video(
Path::new("video.mp4"),
Path::new("output_frames/"),
&video_opts,
&conv_opts,
false // Don't keep intermediate PNG files
)?;
Ok(())
}
use cascii::AsciiConverter;
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let converter = AsciiConverter::new();
// Use built-in presets: "default", "small", or "large"
let small_options = converter.options_from_preset("small")?;
converter.convert_image(
Path::new("input.png"),
Path::new("output.txt"),
&small_options
)?;
Ok(())
}
AsciiConverterMain converter struct for ASCII art generation.
Methods:
new() - Create converter with default configurationwith_config(config: AppConfig) - Create with custom configurationfrom_config_file(path: &Path) - Load configuration from fileconvert_image(input, output, options) - Convert image to ASCII fileimage_to_string(input, options) - Convert image to ASCII stringconvert_video(input, output_dir, video_opts, conv_opts, keep_images) - Convert video to ASCII framesconvert_directory(input_dir, output_dir, options, keep_images) - Convert directory of imagesget_preset(name) - Get a preset by nameoptions_from_preset(name) - Get conversion options from a presetConversionOptionsOptions for ASCII conversion.
Fields:
columns: Option<u32> - Target width in charactersfont_ratio: f32 - Font aspect ratio (width/height)luminance: u8 - Luminance threshold (0-255)ascii_chars: String - ASCII character set (darkest to lightest)Methods:
default() - Create with default optionswith_columns(columns) - Set target widthwith_font_ratio(ratio) - Set font ratiowith_luminance(threshold) - Set luminance thresholdwith_ascii_chars(chars) - Set custom character setVideoOptionsOptions for video conversion.
Fields:
fps: u32 - Frames per second to extractstart: Option<String> - Start time (e.g., "00:01:23" or "83")end: Option<String> - End timecolumns: u32 - Target width in charactersSee the examples/ directory for complete examples:
simple_image.rs - Basic image conversionsimple_video.rs - Video conversionRun examples with:
cargo run --example simple_image
cargo run --example simple_video
./target/release/ascii-gen
--input ./some_frames_dir
--out ../output/sunset_hl
--font-ratio 0.7
./target/release/ascii-gen
--input ../input.webm
--out ../output/sunset_hl
--columns 800
--fps 30
--font-ratio 0.7
This project is inspired by developedbyed's video that I recommend watching, I reused the logic from his bash script and rewrote it in rust so that it could process faster files with more details.