10 releases

0.3.1 Sep 8, 2024
0.3.0 Jul 3, 2024
0.2.2 Jul 1, 2024
0.2.1 Jun 30, 2024
0.1.3 Jan 22, 2024

#463 in Images

Download history 194/week @ 2024-09-06 71/week @ 2024-09-13 35/week @ 2024-09-20 11/week @ 2024-09-27 5/week @ 2024-10-04 2/week @ 2024-10-11 1/week @ 2024-11-01 1/week @ 2024-11-08 2/week @ 2024-11-15 1/week @ 2024-11-22 53/week @ 2024-11-29 309/week @ 2024-12-06

365 downloads per month
Used in png-glitch-cli

MIT license

3.5MB
875 lines

png-glitch

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.

Glitched PNG image

The original image:

The original PNG file is a photo of a media art placed in a slightly darker space.

Example usage

The following snippet glitches ./a_png_file.png by

  • Changing filter method of all scan lines
  • Setting 1 to the 4th byte of each scan line

The 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")?;

Contribution

  1. Fork the repository.
  2. Create a feature branch on your forked repository with git checkout -b feature-name command.
  3. Develop the feature.
  4. Commit your changes with git commit command.
  5. Upload the feature branch to GitHub and create a pull request.

License

Please refer to the LICENSE file.

Dependencies