Skip to main content

Crate cascii

Crate cascii 

Source
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§

convert
crop
loop_detect
preprocessing
render
video

Structs§

AppConfig
Application configuration with presets and ASCII character set
AsciiConverter
Main converter struct for ASCII art generation
ConversionOptions
Options for ASCII conversion
ConversionResult
Result of a conversion operation, containing metadata about the conversion
FfmpegConfig
Configuration for ffmpeg/ffprobe binary paths
Preset
Configuration preset defining quality settings
Progress
Progress information for conversion operations
ToVideoOptions
Options for rendering ASCII frames to a video file
VideoOptions
Options for video conversion

Enums§

OutputMode
Controls what output files are generated
ProgressPhase
Represents the current phase of a conversion operation