Crate ansimage

Crate ansimage 

Source
Expand description

ansimage is a Rust crate for converting images into colorful ASCII and Unicode art for terminal display. It offers a high degree of customization over character sets, color palettes, dithering, and output size.

§Example

use ansimage::{Settings, convert};
use std::path::Path;

fn main() -> ansimage::error::Result<()> {
    let settings = Settings::default();
    let path = Path::new("path/to/image.png");
    let output = convert(path, &settings)?;
    println!("{}", output);
    Ok(())
}

The core functionality revolves around the convert function, which takes an image path and a Settings configuration object to produce the final styled string.

Re-exports§

pub use self::settings::Advanced;
pub use self::settings::AsciiCharSet;
pub use self::settings::CharacterMode;
pub use self::settings::Characters;
pub use self::settings::ColorMode;
pub use self::settings::Colors;
pub use self::settings::DitherMatrix;
pub use self::settings::Dithering;
pub use self::settings::Settings;
pub use self::settings::Size;
pub use self::settings::SizeMode;
pub use self::settings::UnicodeCharSet;

Modules§

error
Defines the error types and Result alias for the ansimage crate.
palettes
This module contains predefined color palettes for use in non-truecolor mode.
processing
Core logic for processing image pixels into styled terminal characters.
sets
This module defines predefined character sets used for ASCII art generation.
settings
Contains all configuration structures for customizing the image conversion process.

Functions§

convert
Converts an image file into a styled terminal string based on the provided settings.
convert_image
Converts a pre-loaded DynamicImage into a styled terminal string.