print_image

Crates.ioprint_image
lib.rsprint_image
version0.1.2
sourcesrc
created_at2024-04-07 04:59:50.288109
updated_at2024-04-07 05:17:10.208858
descriptionPrint an image to the terminal!
homepage
repositoryhttps://github.com/m1chaelwilliams/print-image
max_upload_size
id1198761
size38,571
Sphere (m1chaelwilliams)

documentation

README

Print Image

A super simple solution to printing images in the terminal

Features

  • Printing images
  • Resizing output
  • Custom pixel handling

Usage

use print_image;
use std::path::Path;

fn main() -> Result<(), print_image::PrintImageError> {
	print_img(
		Path::new("path/to/file.png"), 
		Some((12, 12)), 
		print_image::handle_pixel_rgb
	)
}

Custom Pixel Handler

use print_image;
use std::path::Path;

fn main() -> Result<(), print_image::PrintImageError> {
	print_img(
		Path::new("path/to/file.png"), 
		Some((12, 12)), 
		|pixel| {
			match pixel[0] {
				0..=128 => "+".to_string(),
				129..=255 => "-".to_string()
			}
		}
	)
}

Dependencies

  • image - Licensed under MIT or Apache 2.0
  • colored - Licensed under Mozilla Public License Version 2.0

99.99% of the legwork was done by the dependencies for this project. Print Image only provides an easy to use wrapper over them.

License

Code is licensed under MIT. Click here for more information.

Commit count: 8

cargo fmt