Glitching JPG (or JPEG) images by corrupting their data is a relatively straight-forward affair. Simply open up the file in a hex editor and wreck up the place. Corrupted JPG images can be identified by the telltale offset horizontal bands of changing hues and small square sequences of artifact patterns at the beginning or end of these bands.
If you don’t have the time or inclination to manually glitch JPG images you can use dedicated apps such as Glitch for iOS.
If you don’t have a hex editor installed there are some freeware options list at the bottom of this post. Hex editors allow us to view and edit the bytes of a file using hexadecimal. Editing the file using hex rather than text allows greater flexibility since we’re no longer restricted to text characters (which are each represented by two hex digits). Most hex editors display both hex and text (also known as ASCII) in the same view but in separate columns. You can see a JPG open in a hex editor in the image below.
Get started by making a copy of a JPG and open the copy in a hex editor — never edit the original file. The first bytes of a JPG file contain what’s know as the file header. The header contains information that is required for the image to be displayed at all and should be left intact (though feel free to experiment). We need to locate the meat of the file, the raw image data, we can usually tell the raw data apart from the header and other important structural data by it’s garbled nature.
We can see where some data ripe for glitching is in the above example where the file changes from structured, to seemingly random data. Not to say that there’s no structure, it’s just harder to discern in compressed image data. Once we’ve identified the raw image data we can copy/paste chunks, search/replace sequences or just manually corrupt the data by changing the text (on the right side in the example) or the hex (on the left side in the example) of the raw data.
Now we can begin the process of making changes and checking the result in our favorite image viewer. Making backup copies after every successful change will avoid heartaches when, not if, a misstep renders the image unviewable.
Corrupting JPG images often results in interesting patterns due to the corrupt data and the compression algorithms used, as seen enlarged in the example above. Decreasing the quality of the JPG itself, which can be done with image editing software, can sometimes increase the likelihood of generating these artifacts through corruption.
This method can also be used to glitch some other formats as well, most notably BMP files.
As with any glitch-by-corruption technique, too little has no effect, too much can destroy the file, but just enough results in glorious, glorious corruption. #corruptabsolutely
iOS (iPhone, iPad)
Windows Phone
Windows
OSX
Great simple article to get started, thanks!
I tried my first attempt and was successful. Now I am interested in writing a program (maybe c or python) that would take a jpg and manipulate it to get “cool” filters on it.
Any suggestions of where to begin reading about manipulating the binary data to get “traditional” filters?
Currently exploring by trial and error using vim (%!xxd command gives hex dump with index on left and ascii on right like examples above) and messing with jpg binary data.
I tried corrupting some jpegs using XVI32 and corrupted them to the point of not working. How do I exactly corrupt a jpeg right?