Learn how you can corrupt images to make art!
Corrupting files: it doesn’t sound like a good thing does it? It conjures images of broken computers, lost work, and—if you grew up in the early days of home desktops— computer viruses intentionally breaking operating systems.
But, I am here to tell you that it is possible to corrupt files not for evil but for good! Not for destruction, but for art!
In the rest of this article we’ll be dealing with just a brief overview of the world of intentional corruptions and glitch art.
Now, to talk about how corrupting files can be artistic we need to start with describing a little bit about how file formats work and what it means for a computer to store something.
Every picture, every video, every 3D model, every song, every meme at the end of the day is just a very long sequence of 0s and 1s, binary data. What makes a picture different than a song, as far as the computer is concerned, is that the file was made with different conventions.
For example, a JPEG starts with
And ends with
Why? No deeper reason than the fact that we needed to pick something to tell other programs that they’re reading a JPEG to help them understand and display it.
Files tend to put important data about how to interpret the file, like the size of the image or about how it’s been compressed, near the beginning of the file. The very end of the file sometimes also has important data, like the JPEG signal that the image is done. In the middle, though, files tend to have a lot of numbers you can safely mess with in order to make corruptions and glitch art.
A lot of historical ways people corrupt files involve opening them up like they’re a different kind of data. For example, a fun way to distort an image is to open it as an audio file in Audacity, a free and open source audio editing program, apply filters, and then export it again. In the further study section we link to a video tutorial on this. For my part, I started with a photo I took of a sticker on a crosswalk:
And then here’s the file compressed with a delay effect in Audacity:
The repetition, for example, is created by the very literal echo effect created when treating this image like audio.
There are many more tricks like this, including opening images or videos like they’re text documents and saving them back again. This is most infamously done with an old Windows program called Wordpad.
There’s more to glitch art than just images, too. You can mess with video in really fun ways by damaging very particular frames. In most video formats, you have special frames called i-frames that are basically the whole image of that particular frame but then to save space the following frames are just recording the changes from frame to frame. When you break i-frames, you can then get weird smearing effects. You may have seen this happen intentionally or accidentally! It’s called data moshing and there’s a lot of ways to do it with open source tools, as we link below.
But you can also just directly mess with files by editing them at the level of bytes. For example, here’s a version of the same image created by opening the jpg with a program called a hex editor and then just removing chunks of data and copying and pasting other parts.
Lastly, you can also corrupt files in code! This generally involves the tricky business of randomly changing data in the middle of the files, but carefully enough that you don’t completely break them. If you’ve ever seen corrupted video game ROMs this is generally how they work, like the ROM Mutagen project linked below. You can also do glitching of images and videos the same way, like in the Python glitch-art library: https://github.com/delivrance/glitchart/blob/master/glitchart/glitchart.py
There are a bunch of glitch art libraries in Python but I link to this one in particular because you can read the code and see that, overall, it’s pretty simple. It does a little work to make sure it loads and saves the files with the correct format but otherwise it really does just randomly munge the data of the image. I ran it a couple of times on my picture and got something that looked like this:
What we’ve learned here is that there’s an entire huge world of corruptions, glitches, and intentionally damaging files in order to create new kinds of art, art that depends on the underlying truth that at the end of the data it’s all just 0s and 1s.
The Art of PNG Glitch
How to Glitch Images with Wordpad
Unraveling the jpeg
How to Datamosh Videos
Make Abstract Glitch Art Photographs
Glitch an Image on Mac Using Audacity
Also In The February 2022 Issue
Super-charge your searches online with these useful tips!
Come explore the world of virtualization, where there are computers inside computers!
Diving into how the Ladder of Abstraction can help students grasp the bigger picture of difficult concepts.
Learn how you can corrupt images to make art!
Have a whale of a time with this artistic programming language!
Your phone is a really neat piece of technology! Let's explore some of the sensor tech found inside.
Time to warm up the Raspberry pi for another delicious project!
Civic hackers, crowdsourcing, and pizza parties? Tell me more!
Meet the brilliant mathematician and pioneer of coding, Ada Lovelace!
Some worms crawl through your computer instead of the ground, let's learn about them!
What makes a good algorithm? Let's find out!
Join us as we think about the upsides and downsides of making our homes smarter!
Do you think your internet is slow? Wait till you learn about dial-up!
Time for a blast from the past as we look back at some most memorable technology from the early days of modern tech!
Interesting stories about computer science, software programming, and technology for February 2022.
Links from the bottom of all the February 2022 articles, collected in one place for you to print, share, or bookmark.