GitXplorerGitXplorer
T

glitch

public
10 stars
2 forks
2 issues

Commits

List of commits on branch main.
Unverified
965a34973a39221bbc3e50835cd243b5c3a92d07

split out RGB and Token into there own files

TToyz committed 15 days ago
Unverified
cca5636d0b7a09455aafe930401fa2a66345dbd3

more updates to eval

TToyz committed 15 days ago
Unverified
ef998fea44e7d02b962d7f40a8f842ae8f043523

updated eval + better brightness support

TToyz committed 15 days ago
Verified
44fdc358f57c3b8e551c3aa064182d7847df8814

Create FUNDING.yml

TToyz committed 16 days ago
Unverified
fc36cb0345aa829d9c272f382e6c7ed3b70811b3

fixed gitignore to handle all output

TToyz committed 16 days ago
Unverified
458c13d92a365fa71d3b865b8d86b41345a3d608

webp support cause why not

TToyz committed 16 days ago

README

The README file for this repository.

Glitch

This is a simple port of https://github.com/sug0/go-glitch to rust.

What is the deal with the expressions?

You can think of the image as a functor that you map an expression to, for each pixel's component colors, returning a new one. The allowed operators are:

Custom operators

  • t a pixel made up of a random color component from the neighboring 16 pixels
  • g a pixel made up of a random color component from random locations in the image
  • r{Num} a pixel made up of a random color component from the neighboring Num pixels
  • R{Num} the red color component defined by Num (i.e. R255 is the same as R)
  • G{Num} the green color component defined by Num (i.e. G255 is the same as G)
  • B{Num} the blue color component defined by Num (i.e. B255 is the same as B)
  • i inverts the color component
  • b{Num} the brightness of the color component defined by Num (i.e. b255 is the same as b)

Ported from go-glitch

  • + plus
  • - minus
  • * multiplication
  • / division
  • % modulo
  • # power of operator
  • & bit and
  • | bit or
  • : bit and not
  • ^ bit xor
  • < bit left shift
  • > bit right shift
  • ? returns 255 if left side is greater otherwise 0
  • @ attributes a weight in the range [0, 255] to the value on the left

The expressions are made up of operators, numbers, parenthesis, and a set of parameters:

  • c the current value of each pixel component color
  • b the blurred version of c
  • h the horizontally flipped version of c
  • v the vertically flipped version of c
  • d the diagonally flipped version of c
  • Y the luminosity, or grayscale component of each pixel
  • N a noise pixel (i.e. a pixel where each component is a random value)
  • R the red color (i.e. rgb(255, 0, 0))
  • G the green color (i.e. rgb(0, 255, 0))
  • B the blue color (i.e. rgb(0, 0, 255))
  • s the value of each pixel's last saved evaluated expression
  • r a pixel made up of a random color component from the neighboring 8 pixels
  • e the difference of all pixels in a box, creating an edge-like effect
  • x the current x coordinate being evaluated normalized in the range [0, 255]
  • y the current y coordinate being evaluated normalized in the range [0, 255]
  • H the highest valued color component in the neighboring 8 pixels
  • L the lowest valued color component in the neighboring 8 pixels

Examples

  • 128 & (c - ((c - 150 + s) > 5 < s))
  • (c & (c ^ 55)) + 25
  • 128 & (c + 255) : (s ^ (c ^ 255)) + 25