bardecoder icon indicating copy to clipboard operation
bardecoder copied to clipboard

[FR] add CLI

Open NightMachinery opened this issue 3 years ago • 1 comments

Add a CLI:

bardecoder file.png

NightMachinery avatar Sep 14 '21 21:09 NightMachinery

Here's my main.rs for a CLI.

use bardecoder;
use bardecoder::prepare::BlockedMean;

use image;

use std::env;

fn main() {
    let img = image::open(env::args().last().unwrap()).unwrap();

    // Use default decoder builder
    let mut db = bardecoder::default_builder();

    // Use some different arguments in one of the default components
    //db.prepare(Box::new(BlockedMean::new(7, 9)));

    // Build the actual decoder
    let decoder = db.build();

    let results = decoder.decode(&img);
    for result in results {
        println!("{}", result.unwrap());
    }
}

itdaniher avatar Dec 25 '21 18:12 itdaniher