Crates.io | arko |
lib.rs | arko |
version | 0.2.4 |
source | src |
created_at | 2022-01-27 22:00:23.376152 |
updated_at | 2024-09-18 13:17:51.416914 |
description | A small library for pixel manipulation in images |
homepage | |
repository | |
max_upload_size | |
id | 522771 |
size | 2,235,061 |
Arko is a small library providing three pixel manipulation algorithms :
The library also contains a minimal image convertion tool (supporting png and jpg).
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".
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);
When using these functions the probability is the same applyed to all colors.
Params :
Examples :
let colors = vec![Colors::Red, Colors::Yellow, Colors::Green];
arko::slim_bottom_to_top_global("input.png", "btt.png",true, 40, colors);
arko::slim_left_to_right_global("input.png", "ltr.png",true, 40, colors);
arko::slim_right_to_left_global("input.png", "rtl.png",true, 40, colors);
arko::slim_top_to_bottom_global("input.png", "ttb.png",true, 40, 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)]);
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);
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);
Params :
Examples :
arko::convert("input.png", "output.jpg", true);