| Crates.io | png-glitch |
| lib.rs | png-glitch |
| version | 0.5.0 |
| created_at | 2024-01-11 00:14:00.945019+00 |
| updated_at | 2025-01-10 08:53:18.862142+00 |
| description | A library to glitch PNG images. |
| homepage | |
| repository | https://github.com/chikoski/png-glitch |
| max_upload_size | |
| id | 1095733 |
| size | 4,269,917 |
A library to glitch PNG files. This library is inspired by the pnglitch, a Ruby library to glitch PNG images.
Please visit "The Art of PNG Glitch" for more details about glitching PNG images.

The original image:

The following snippet glitches ./a_png_file.png by
1 to the 4th byte of each scan lineThe glitched image is emitted to ./glitched.png.
use png_glitch::{FilterType, PngGlitch};
let mut png_glitch = PngGlitch::open("./a_png_file.png")?;
png_glitch.foreach_scanline(|scan_line|{
scan_line.set_filter_type(FilterType::None);
scan_line[4] = 1;
});
png_glitch.save("./glitched.png")?;
git checkout -b feature-name command.git commit command.Please refer to the LICENSE file.