Expand description
§cascii - ASCII Art Generator Library
cascii is a high-performance library for converting images and videos into ASCII art.
§Features
- Convert single images to ASCII art
- Extract and convert video frames to ASCII
- Configurable character sets and quality presets
- Parallel processing for high performance
- Progress reporting for integration with UI applications
§Example
use cascii::{AsciiConverter, ConversionOptions};
use std::path::Path;
// Convert a single image
let converter = AsciiConverter::new();
let options = ConversionOptions::default().with_columns(400);
converter.convert_image(
Path::new("input.png"),
Path::new("output.txt"),
&options
)?;§Progress Reporting
For video conversions, you can receive detailed progress updates:
use cascii::{AsciiConverter, ConversionOptions, VideoOptions, Progress, ProgressPhase};
use std::path::Path;
let converter = AsciiConverter::new();
let video_opts = VideoOptions::default();
let conv_opts = ConversionOptions::default();
converter.convert_video_with_detailed_progress(
Path::new("video.mp4"),
Path::new("output"),
&video_opts,
&conv_opts,
false,
|progress| {
match progress.phase {
ProgressPhase::ExtractingFrames => println!("Extracting frames..."),
ProgressPhase::ExtractingAudio => println!("Extracting audio..."),
ProgressPhase::ConvertingFrames => {
println!("Converting: {}/{} ({:.1}%)",
progress.completed, progress.total, progress.percentage);
}
ProgressPhase::RenderingVideo => println!("Rendering video..."),
ProgressPhase::Complete => println!("Done!"),
}
},
).unwrap();Re-exports§
pub use crop::crop_frames;pub use crop::run_trim;pub use crop::CropResult;
Modules§
Structs§
- AppConfig
- Application configuration with presets and ASCII character set
- Ascii
Converter - Main converter struct for ASCII art generation
- Conversion
Options - Options for ASCII conversion
- Conversion
Result - Result of a conversion operation, containing metadata about the conversion
- Ffmpeg
Config - Configuration for ffmpeg/ffprobe binary paths
- Preset
- Configuration preset defining quality settings
- Progress
- Progress information for conversion operations
- ToVideo
Options - Options for rendering ASCII frames to a video file
- Video
Options - Options for video conversion
Enums§
- Output
Mode - Controls what output files are generated
- Progress
Phase - Represents the current phase of a conversion operation