Glitch Art Filters?

(G'MIC staff) #41

Here’s my trial, already available after a filter refresh:

The source code:

#@gui Self glitching : fx_self_glitching, fx_self_glitching_preview(1)
#@gui : Multiplier = float(0,-5,5)
#@gui : Bias = float(0,-255,255)
#@gui : Negate = bool(0)
#@gui : Operator = choice("Add","Mul","And","Or","Xor","Pow","Reverse pow","Mod","Reverse mod")
#@gui : Shift point = point(50,50,0,1)
#@gui : Boundary = choice(3,"Zero","Nearest","Periodic","Mirror")
#@gui : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right","Duplicate horizontal","Duplicate vertical","Checkered","Checkered inverse"), Preview split = point(50,50,0,0,200,200,200,0,10,0)
#@gui : sep = separator(), note = note("<small>Author: <i>David Tschumperl&#233;</i>.      Latest update: <i>2018/08/19</i>.</small>")
fx_self_glitching :
  repeat $! l[$>] split_opacity l[0]
    f "init(
         shift = ([w,h]-1)*(50-[$5,$6])%;
         const sign = $3?-1:1;
         const boundary = $7;
       val = sign*((2^$1)*j(shift) + $2);
       ($4==0?(val + i):
        $4==1?(val * i):
        $4==2?(val & i):
        $4==3?(val | i):
  endl a c endl done

fx_self_glitching_preview :
  gui_split_preview "fx_self_glitching $*",${-3--1}

Let me know what you think about it.


Self-Glitching has an opacity-related problem. Sometimes, image gets erased. Other time, partly transparent. Other than that, I like it the best.

(G'MIC staff) #43

Image and parameters to reproduce the issue ?

OK, should be fixed, will be available in a minute or two.


Thank you for fixing it. There’s one more thing I would like to see, there’s a option called ‘Mod’ in garagecoder’s version of his filter. Would be a great addition as a option.

EDIT: Hey, thanks for the new options. I love it.

EDIT: Well, I tried thinking about how I can go by doing this. Instead of percentage-based values, I was thinking of doing pixels shift for Self-Glitching, and to allow more than 2 layers similar to garagecoder filter. Pixel shift seem harder than it looks

I did part of the work, but problem is that it’s on the corner, and the other problem is that it’s float and not integer - shift = ([$5,$6]); I don’t think I know enough about coordinate math to solve this tricky thing. I guess I should attempt to do without using points when I do have the time.

If both are 0, then image don’t change with binary operator except XOR.

(dumb) #45

Glad to see this thread has some activity. I made a group of filters which are not unlike this new one (which works a treat!), I called them ‘Sawtoothers’ because of the waveforms that it tries to map the values in images to. In terms of the maths involved it’s a basic modulo function that’s applied to individual channels; I’ve made one each for the HSV, CMYK and RGB colour spaces. I’ve tried to do YCbCr but that’s much more difficult because some combinations of channel values don’t work; the shape of the space is different as are whatever vectors the channels represent.

Here’s the HSV Sawtoother operating on a random gradient:

…and here’s the RGB one on the same original gradient:

A little bonus: is the source for the functions. I would like to figure out how to integrate the functionality of this function into the ‘Self-glitch’ function but it looks like it uses a new layer to perform the operations on an RGB image as a whole rather than splitting it into individual channels and then messing with them without duplicating any layers as the Sawtoothers do.

The differences between this and a standard modulo besides operating on individual channels is that one can phase-shift each channel, multiply the values to get more distinct bands and even ‘smooth’ the channels before performing the modulo function to allow for ‘dreamy’ and ‘watery’ images.

(dumb) #46

I’ve messed with the self-glitch filter and now it’s an odd cascading thing with a bit of randomness thrown in:


(dumb) #47

Second update. I’ve tweaked the shift randomisation thing slightly and added many more operators (the filter now has 19!) Average, divide and reverse divide get very wacky when the bias is near 0.

Edit: the modulo (but not reverse modulo, which I’ve fixed since posting the above source) operator produces some odd artefacts on some but not all images regardless of the other settings:

My only clues are that the lines are usually 2-3 in width and around 255 pixels apart.


I absolutely love the Self-Glitching varient made you made @Joan_Rake1. It is a step-up from the original filter made by @David_Tschumperle .

Never mind about the sawtoothers filter.

(dumb) #49

Cool stuff; I hope to get at least some more of the Sawtoother functionality into this new filter. I’ve added even more operations:

I want to make something which uses complex number division, something like (val + i*i) / (i + i*val), I wonder what results that would yield. For now, have some rubbish that I made with it:

(G'MIC staff) #50

I’ve put your filter in your (newly created) Testing / Joan Rake/ folder.

(dumb) #51

Updated again. Now it can shift the image that it starts with. Next: operating on individual channels. I’d love to see it work on PCA channels, for example. YCbCr too.


I would love to see that too, and as well as different color models. Imagine converting RGB images to integer values of different channels in specified color model, and the result are processed right back. The glitch filter is so much fun to use.

(dumb) #53

I’ve added it now. The alpha business is still a bit tricky (I want to separate the channel and add an option to process it or leave it be) but the thing works a treat now with 12 modes to choose from:


The last one I want to add is a PCA factor thing like the in the mixer that David recently added. This thing would melt images in yet another very odd way. I also might need to tune the modulo at the end to suit the various colour spaces.


Thanks for the upgrade. I do have a idea for how to apply different operations to different channel.

Alpha goes first, and there is up to 4 more group of sliders besides Alpha. The reason for 5 group of slider is because CMYKA very existence. There could be 6 group of sliders though. One for operating with all operating channels except Alpha. I’m guessing bool would be needed to determine which sliders work.

Also, just found out I can turn pictures into vaporwave with the filter upgrade

Original -


(dumb) #55

Updating again, I’ve used some more channel conversion options. I’ve decided to make allow one to switch between two similar options with a single checkbox rather than shove a very long list into the choice box.


Joan_Rake1, you fixed some of the color space issues by allowing rgb8, hsv8. Actually, I think I could use the cascading glitch filter to replace my modulus operation as they have more channels operation. Maybe the something like HSV/HSV8 option could apply to the sawtoothing filter? It would solve my issue with those at the moment.

(dumb) #57

If I simply change the channel mode in the HSV Sawtoother to HSV8 it breaks and outputs completely-black images. It works fine with HSV here even if the sat and hue channels are treated like RGB channels. The hue channel can’t be treated as an RGB channel because it’s meant to cycle around. Are you looking to be able to use it as a channel with 256 values (0-255) instead of 360 (0-359)? That would be easily-fixed through using a coefficient.

(dumb) #58

New version again. Added more operators including some which mess with more than one channel at a time for each channel value, also added an option for the shift target to apply to the first or final shift to allow for much smaller shifts. Also upped the iterations limit to 32 instead of 10. Using the beach image with some slight curves manipulation leads to results like these:




Actually, never mind. They do work fine now. Personally, I think of factor as multiplier, and multiplier as factor, but either way works by design. I love the new version of Cascading Filter.

(dumb) #60

Weird bug that I’m not sure how to fix: in the cascading filter the preview result differs wildly from the actual result when I use this new YCbCr8 colour space that GC helped with in the G’MIC exercises thread. This does not change even if any of the other options - including the preview size - change.