Category: Programming

The Power of GIFKR

So this blog post is just going to go through some of my favorite GIFKR based art. If you want to try it out yourself, download GIFKR here. It’s currently in beta so it’s still improving and changing quite a bit, but despite being a bit rough around the edges everything should work okay. Here’s what the program looks like as of now: gifkr.png

Even just playing around with filters on the default image can make some pretty awesome looking stuff. This one is just a standard Total RGB Pixel Sort but instead of filling the areas between the threshold with sorted pixels, it’s a gradient from the first pixel to a turquoise color. GIFKR includes regular pixel sorting, but also a few options to tweak the basic algorithm. Also notice how the filter is applied at an angle and the image isn’t cropped. I’m not sure if I invented this technique but I can’t find it anywhere else.

reglitched logo

Let’s get into some art, shall we? This is one of my favorites. Pixel sorting by hue, but the boundaries are simply lines. Another variant of pixel sorting included in GIFKR. Pixel sorting can turn a beach sunset into a New York sunrise.

newyorkbeach

Now I’m not going to try and tell you the next one is a masterpiece. But this gives you an idea of what I mean by sorting at an arbitrary angle. And don’t mind the slight shake, I implemented a fix for that after I made this GIF.

sand

The other feature that I thought was unique about GIFKR is the ability to apply a filter at different angles on RGB channels. So this is my friend mark and the translate filter with each channel set at 90° from any other. This feature seems to add a lot of power without much complexity, and I find it very handy at times.

mark

The gradient pixel sort filters can be pretty creepy on certain subjects.

eyebrows

Honestly I think it’s one of the most powerful in the program.

snowwy.png

Don’t forget about the non-sort based effects. They can do cool things too.

psychadelic

I find that explosion gifs make good subjects.

I’ll let you in on a secret. GIFKR + Memes = reddit karma.

The filters, for better or worse, let you take them to the absolute extreme. This was once a picture of squidward.

glitch(2)

If you do it with intent, sometimes making an image entirely incomprehensible can create really neat looking abstract art. This was originally a pic of my brother skiing.

snow1

Also combining it with my Klauber Triangle wallpaper making program can produce some awesome looking stuff.

Really it’s hard to find something that can’t be made into an interesting GIFKR image or GIF.

So there are ton’s of image filterers and pixel sorters out there, what makes GIFKR not just another Glitch in the Wall?

glitchinthewall

There are things out there that are more powerful than GIFKR. Processing, for example. However, you have to write code or at the very least edit scripts to produce anything. There’s no live preview, so you have to enter your variables, render, and hope it looks good. If it doesn’t, you have to try again. The pixel sorters that don’t require coding seem to have this issue as well. In fact, the first article about pixel sorting that shows up on google tells you to tweet a picture and get your pixel sorted result tweeted back. A neat trick, but artists deserve better than that. There’s also just the unique features of the program that others simply don’t have: GIFs are supported natively. You can pixel sort at any arbitrary angle. You can filter by channel. You can make keyframe-like animations. Even though you’re not coding, there’s a lot of power just a few clicks and drags away.

Channel Sorting

So by now there’s a decent chance you’ve seen art involving pixel sorting:

Pixel sorting is a very simple image manipulation technique where you compare every pixel in an image to the one adjacent to it, and if they are within a given tolerance, make the second pixel the same color as the first. It is worth noting that the algorithm doesn’t actually involve any sorting, though there are variations of it that do. Here’s a GIF of me being pixel sorted and increasing the tolerance on each frame:

vid2gif

Neat right? Well I thought to myself, pixels can be separated int red, green, and blue components, what would happen if I pixel sorted them in different directions? This is what I call channel sorting. And it also makes some cool stuff happen:

In this case red is sorted right, green left, and blue down.

So how did I make these cool GIFs? I’m using a program called GIFKR, but it’s not quite finished yet. It’ll be ready soon™, so follow this blog or my twitter to be one of the first people to try it out. It also can do crazy stuff like this:

glitch(1)

glitch(6)

 

So yeah it supports GIFs, changing the angle and value of the filter over time, and includes some cool custom filters.

Abusing toString()

So I’m working on a program that has some /r/Glitch_Art inspired image filters for fun, and even has a fancy little GUI. I love thinking of new algorithms to screw up images, but hate having to write GUI code for every new filter I add. My solution? Let toString() do the work by un-camel-casing and spacing the class names.

public String toString() {
    String s = this.getClass().getName();
    s = s.replace(this.getClass().getPackage().getName()+".", "");
        
    for(int i = 1; i < s.length(); i++)
        if (Character.isUpperCase(s.charAt(i))) {
            s = s.substring(0, i)+" "+s.substring(i);
            i++;
        }
    s = s.toLowerCase(); 
    return Character.toUpperCase(s.charAt(0)) + s.substring(1);    
}

The result:

Screen Shot 2016-02-11 at 4.42.10 PM

Unfortunately it seems there’s no way to dynamically get all subclasses of something in a running program, so i still have to manually add an instance of each filter to a list. What a chore. I’ll keep looking for a way to misuse reflection to do it though, and will let you know if I figure something out.