Crate image_toolbox

Source
Expand description

Quick to start, different and random Image operations. Feel free to contribute and add new features via a Pull Request.

§How to use

In Cargo.toml

[dependencies]
image-toolbox = "*"

§The histogram struct

use image_toolbox::{Histogram, load_img};
use image::{DynamicImage};
 
// load img 
let img = load_img("./test/bright_miami.jpg").unwrap();
let histogram = Histogram::new(&img);
println!("{:?}",histogram);
// get the r,g,b probability of some pixel value 
let (p_r,p_g,p_b) : (f32,f32,f32) = histogram.probability(200);

§turn a TOO bright image into normal colors

use image_toolbox::{load_img,normalize_brightness,save_img};
 
let img = load_img("./test/bright_miami.jpg").unwrap();
let new_image = normalize_brightness(&img).unwrap();
save_img(&new_image,"./test/result.jpg").unwrap();

Structs§

Histogram
Histogram representation of an image represents the distribution of Red,Green,Blue pixels in an image.

Enums§

Pix
used to represent pixel color type in Histogram struct

Functions§

load_img
Load any type of image uses DynamicImage type.
normalize_brightness
transform a very bright image into normal brightness based on histogram equalization wrapper for transform_from_histogram function.
save_img
Save an image to disk
transform_from_histogram
turn a very bright image into a normal looking one by using histogram equalization.
transform_pixel