Crates.io | pnglitcher |
lib.rs | pnglitcher |
version | 0.3.2 |
source | src |
created_at | 2022-06-08 18:50:06.799547 |
updated_at | 2024-09-18 13:31:53.36413 |
description | PNG glitcher |
homepage | |
repository | https://gitlab.com/girflo/PNGlitcher |
max_upload_size | |
id | 602208 |
size | 122,748 |
This crate contains a library allowing you to glitch PNG images. Most of the code comes from the PNG encoder written for the wonderful Image crate. The idea here is to provide a tool similar to the Ruby gem PNGlitch for Rust. The output of an image will not be the exact same as PNGlitch, it's simply used for inspiration.
At the moment this cargo is in heavy WIP, any release could introduce breaking changes so please use this crate for having fun and create weird looking PNG images.
For each occurence this algorithm will copy data from another part of the image, then force the png to use a given filter.
Params
Examples
pnglitcher::duplicate("input1.png", "output1", true, 3, 1, 0);
pnglitcher::duplicate("input2.png", "output2", true, 0, 100, 1000);
Create a sample using duplicate algorithm for all filters for a given image
Params
Examples
pnglitcher::duplicate_sample("input1.png", "output1", true, 1, 0);
pnglitcher::duplicate_sample("input2.png", "output2", true, 100, 1000);
For each occurence this algorithm will replace the data with 0, then force the png to use a given filter.
Params
Examples
pnglitcher::replace("input1.png", "output1", true, 0, 1);
pnglitcher::replace("input2.png", "output2", true, 4, 1);
Create a sample using duplicate algorithm for all filters for a given image
Params
Examples
pnglitcher::replace_sample("input1.png", "output1", true, 1);
pnglitcher::replace_sample("input2.png", "output2", true, 10);
Save each lines with a different png filter.
Params
Examples
pnglitcher::variable_filter("input1.png", "output1", true, true);
pnglitcher::variable_filter("input2.png", "output2", true, false);
Force the png encoder to use a wrong filter
Params
Examples
pnglitcher::wrong_filter("input1.png", "output1", true, 0);
pnglitcher::wrong_filter("input2.png", "output2", true, 2);
Create a sample using wrong filter algorithm for all filters for a given imageParams
Examples
pnglitcher::wrong_filter_sample("input1.png", "output1", true);
pnglitcher::wrong_filter_sample("input2.png", "output2", true);