This is a guide of what you can do to break the .png file format for glitch art, and how different settings affect the results!

For this tutorial, I am assuming you have the means to alter a file on a lower level (the ability to run arbitrary code on your device). For the making of this tutorial, I used a script that I made, that I ocassionally add features to over time. here is a link

As a starter for this tutorial, lets go over some important terms

.png is a file format. Files on your computer are literally just long lines of binary written onto your hard drive. These 1s and 0s, called machine code, are typically read in chunks of 8, called a byte. (Fun fact, a single 1 or 0 is called a bit, and 4 bits is a nibble!)

To actually convert these long strings of binary into something meaningful, it has to be stored in a predictable way. Your image is broken down into its bytes, and then these bytes are written to the hard drive using a algorithm. ( a set of patterns and instructions that the computer can follow to accomplish a task) Which algorithm gets used depends on what file format you use.

To read the file again, the file is changed back into an image using a reading algorithm. How does the computer know which algorithm to use when reading a file? One way the computer uses is the file format extension, that’s what the “.mp3” or the “.png” parts of the filename is.

.png is a lossless compression file format. It’s a term used to describe the behavior of the reading and writing algorithm of .png. Lossless means that the exact data values you put in, are the exact values that you get back when you read the file. This is a super important property for things like artwork, or sensitive images that need to stay intact, like a barcode. Lossy file formats, like .jpg, will save the data by looking at chunks of data, and use closely matching, but simpler patterns, to describe the data you are trying to write. You might be thinking, “why would an file format ever be lossy, and not save exactly what I put in?” Well that brings us to the idea of compression.

Compression is the making of the file smaller than the raw bytes of the image. it makes it more efficient to store on a hard drive. .jpg is a Useful file format, because of its lossy nature, it can manage to store images in a smaller file size than .png, however .png has the advantage of being higher quality, but still a signifigant file size improvement over the raw data.

The data stored in the .png file, while a 100% accurate representation of the image we saved, doesn’t actually resemble the image at all when looked at. The compression algorithm took a bunch of shortcuts to cut down on the files size. This file is closer to a list of instructions for the .png read program to follow, than it is to a picture. By changing the data in this file, we can change the behavior of the program that ‘repaints’ our saved picture. This is what will create the glitched effect, when the computer starts recreating the image incorrectly>

Time to break it!

The thing is, the .png file actually has a LOT of options. Depending on which options you pick, you can actually get various effects when you are breaking your files. If you have a decent image editing software, it will let you save with options. I used Paint Shop Pro X2. To view the pictures, I used Window’s image viewer in windows 7. These presented images are screenshots from the viewer, to produce clean, unglitched images that will properly display on your computer. The viewer you choose is important, as many programs will give up, and display nothing if they come across a file with glitches. Many times, these glitched files cannot be read, or will just look like noise:

Lets start our adventure into the glitch aesthetic, with the palette. The palette is a algorithm that lets you store all of the colors used in the picture in a list. Using a palette can reduce file size because instead of saving the raw color bytes, it saves where in the list of colors a pixel’s color is.

Setting our image to have a palette size smaller than the number of colors in the image though, will cause some data to be lost.

This image has 32 colors in the palette. I’m choosing the colors used in my palette by the optimized octree setting.

This image has some nice features. The image colors used are all matching colors that already exist in the image. These settings will produce images with a lot of offset lines.

Now lets introduce interlacing. Interlacing is a feature of the .png file to be read and displayed as it loads in increasing resolution. It uses the Adam7 interlacing algorithm. which can be explored further in the wikipedia article here. I highly reccomend giving it a look through as well. This picture was saved with the same settings as before, but with interlacing selected

The interlacing being offset creates a grid like afterimage. Again you can see the colors stay within what the image already uses becasue of the pallette option.

But we live in the modern age! Things dont have to be THAT compressed. Let’s go full on 24 bit color. By not using palettes anymore, any color is possible. This is pretty obvious in the results.

You will notice a few things about this option setup. First, the bands of noise. It actually isn’t pure noise, you can still see some features through it, like the nose and mouth. Though, that probably isn’t the first thing you noticed. The large bands of rainbow gradients stick out. With this method these rainbow bands do not always appear. In fact, most images will just look like the 2nd image.

But they occasionally do appear. They always go diagonally and they always are a single color(however they can merge together). Typically they will appear in long rows across the image, but sometimes they are single pixels all by themselves. you can see both in the example.

This setup, of using 24 bit .pngs is probably going to be the most common you will use, since the streaks can be so spectacular, and because most .pngs you download or save will default to these settings.

But what happens if we turn on interlacing again?

Because of the interlacing, the streaks can appear in the top, or the bottom rows. Depending on where the bits get altered, the interlacing can make the image more visible, since you will see the image through the grid like interlacing. Let’s add in another option, transparency. Since this picture has no transparent pixels to begin with, let’s just see what adding that extra layer of byes does. This essentially makes it a 32 bit .png.Not much different in terms of features to the 24 bit .png. After a certain image resolution, (about 2048x2048 and beyond) the glitches would sometimes manifest in different ways than the previous varieties. Large cascading waterfalls of color start to appear.

These waterfalls seems to evolve out of those streaks of color int he 24 bit .png glitches. (this image was made using a high resolution 24 bit image) By using this information, you should be able to have a helpful guide to glitching your images into a specific desired aesthetic. Due to the random nature of it, it might take a few tries, but it will give you more options to artistically explore! As well, give a look to how .jpg and other file formats will turn out when they are glitched as well. Different file algorithms will give different results.