arko (2022)

Project Rust crate

Arko is a small library providing three pixel manipulation algorithms :

The library also contains a minimal image convertion tool (supporting png and jpg).

How to use it

All of the algorithms can be used in four directions :

For algorithms using colors here are the complete list of available colors : "white", "black", "grey", "red", "yellow", "green", "cyan", "blue", "magenta".

Brush

Params :

Examples :

arko::brush_bottom_to_top("input.png", "btt.png",true, 100, 4, 20);
arko::brush_left_to_right("input.png", "ltr.png",true, 100, 4, 20);
arko::brush_right_to_left("input.png", "rtl.png",true, 100, 4, 20);
arko::brush_top_to_bottom("input.png", "ttb.png",true, 100, 4, 20);

Slim

Probability global

When using these functions the probability is the same applyed to all colors.

Params :

Examples :

arko::slim_bottom_to_top_per_color("input.png", "btt.png",true, vec![(Colors::Red, 20), (Colors::Yellow, 34), (Colors::Green, 56), (Colors::Cyan, 45), (Colors::Blue, 64), (Colors::Magenta, 23)]);
arko::slim_left_to_right_per_color("input.png", "ltr.png",true, vec![(Colors::Red, 20), (Colors::Yellow, 34), (Colors::Green, 56)]);
arko::slim_right_to_left_per_color("input.png", "rtl.png",true, vec![(Colors::Green, 56), (Colors::Cyan, 45), (Colors::Blue, 64)]);
arko::slim_top_to_bottom_per_color("input.png", "ttb.png",true, vec![(Colors::Cyan, 45), (Colors::Blue, 64), (Colors::Magenta, 23)]);

Probability per colors

When using these functions the probability is provided per color.

Params :

Examples :

arko::slim_bottom_to_top_per_color("input.png", "btt.png",true, vec![(Colors::Red, 20), (Colors::Yellow, 34), (Colors::Green, 56), (Colors::Cyan, 45), (Colors::Blue, 64), (Colors::Magenta, 23)]);
arko::slim_left_to_right_per_color("input.png", "ltr.png",true, vec![(Colors::Red, 20), (Colors::Yellow, 34), (Colors::Green, 56)]);
arko::slim_right_to_left_per_color("input.png", "rtl.png",true, vec![(Colors::Green, 56), (Colors::Cyan, 45), (Colors::Blue, 64)]);
arko::slim_top_to_bottom_per_color("input.png", "ttb.png",true, vec![(Colors::Cyan, 45), (Colors::Blue, 64), (Colors::Magenta, 23)]);

Sort (Brut)

These functions will affect the entire image and sort pixels either horizontally either vertically.

Params :

Examples :

arko::sort_brut_bottom_to_top("input.png", "btt.png", true);
arko::sort_brut_left_to_right("input.png", "ltr.png", true);
arko::sort_brut_right_to_left("input.png", "rtl.png", true);
arko::sort_brut_top_to_bottom("input.png", "ttb.png", true);

Sort (Smart)

Params :

Examples :

arko::sort_bottom_to_top("input.png", "btt.png", true, 0, 50, 360, false, 0, 0, 1);
arko::sort_left_to_right("input.png", "ltr.png", true, 0, 50, 360, false, 0, 0, 0);
arko::sort_right_to_left("input.png", "rtl.png", true, 0, 50, 60, true, 70, 80, 1);
arko::sort_top_to_bottom("input.png", "ttb.png", true, 0, 50, 60, true, 90, 100, 0);

Converter

Params :

Examples :

arko::convert("input.png", "output.jpg", true);
🏷 rust glitch