Crates.io | ascii-rs |
lib.rs | ascii-rs |
version | 0.1.2 |
source | src |
created_at | 2024-10-12 06:13:21.15423 |
updated_at | 2024-10-12 06:21:18.822594 |
description | Process image into colored-ascii image |
homepage | |
repository | |
max_upload_size | |
id | 1406165 |
size | 552,714 |
use rascii::image_proc::ImageEngine;
use std::error::Error;
use std::io::stdout;
fn main() -> Result<(), Box<dyn Error>> {
let source = image::open("charizard.png")?;
let engine = ImageEngine::new(source);
let mut writer = stdout();
engine.render_to_text(&mut writer, 0, Some(256), None)?;
Ok(())
}
use rustascii::{image_proc::ImageEngine};
use std::{error::Error, io::stdout};
fn main() -> Result<(), Box<dyn Error>> {
let source = include_bytes!("charizard");
let engine = ImageEngine::from_slice(source)?;
let mut file_writer = fs::File::create_new("your-new-file")?;
// If only one of the axis is set,
// the image aspect ratio will be preserved
engine.render_to_text(&mut file_writer, 0, Some(128), None)?;
Ok(())
}
Origin
Rendered