Skip to content

chikoski/png-glitch

Repository files navigation

png-glitch: a tool to glitch PNG images

Installation

To install png-glitch from source, run the following command:

% cargo install png-glitch --locked 

Usage

png-glitch glitches given PNG file (or directory) and emits the result. By default, it saves to glitched.png.

Command Line Options

Option Description Visual Impact
--transpose <N> Randomly swaps blocks of scanlines. Creates horizontal "slicing" and shearing.
--shift-channels <R,G,B> Shifts color channels independently. Color fringing or radical color shifts.
--invert Inverts all color values. Classic "negative" look.
--brighten <N> Adjusts brightness (0-255). Can cause "blown out" or solarized effects.
--replace <N> Replaces pixels with noise (0.0 - 1.0). Digital "snow" or "static".
--set-zero <N> Sets random pixels to zero (0.0 - 1.0). Black pixel noise.
--remove-filter Strips all PNG filters before glitching. Cleans the canvas for more predictable results.
--sub, --up, --paeth Force a specific PNG filter type. Dramatic vertical or horizontal streaking.
--seed <N> Set a seed for random operations. Reproducible glitch patterns.

Batch Processing

To glitch multiple images at once, provide a directory as the main argument and use the --batch-output flag:

% png-glitch ./my_images --batch-output ./glitched_results --invert --seed 12345

The tool will recursively find all .png files and process them with a progress bar.

Configuration File

You can define complex glitch pipelines in a YAML file:

filters:
  - type: RemoveFilter
  - type: Invert
  - type: Brighten
    strength: 30
  - type: Transpose
    magnitude: 0.1
  - type: ChangeFilterType
    magnitude: 0.05

Run it with:

% png-glitch input.png --config my_glitch.yaml

Documentation

Example

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

And the glitched one:

In this repository

This repository consists of the following things:

  • png-glitch-cli, a binary crate for a command line interface (CLI) to glitch PNG files.
  • png-glitch crate, a library to glitch PNG images.
  • glitch-context crate, a high-level API to orchestrate glitch filters.

Licence

MIT License. Please refer to LICENCE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages