ocr 0.1.0

A minimalist OCR library for Rust — from scratch, no external engine
Documentation
use std::path::Path;

fn main() {
    let out_dir = std::env::args().nth(1).unwrap_or_else(|| "examples/images".to_string());
    let dir = Path::new(&out_dir);
    std::fs::create_dir_all(dir).expect("create output dir");

    let images = [
        ("hello_world.png", "HELLO WORLD"),
        ("alphabet.png", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"),
        ("digits.png", "0123456789"),
        ("lowercase.png", "abcdefghijklmnopqrstuvwxyz"),
        ("multiline.png", "LINE ONE\nLINE TWO\nLINE THREE"),
        ("sentence.png", "THE QUICK BROWN FOX"),
        ("mixed.png", "ABC 123 XYZ"),
        ("punctuation.png", "HI! OK? YES."),
    ];

    for (filename, text) in &images {
        let img = ocr::render::render_text(text, 6);
        let path = dir.join(filename);
        img.save(&path).expect(&format!("save {}", filename));
        println!("Generated: {}", path.display());
    }

    println!("\nDone. {} images written to {}", images.len(), dir.display());
}