# What is databending and how does it actually work?

It is, from what I understand, opening images as audio, applying effects, exporting back as image and voila! glitch-art

Example:

credit

But how does it really work? How/what change in frequencies(?) affect the pixels? It can't be totally random since some of them aren't completely distorted..

How does time(in audio) relate to the dimensions and colors of the image?

• Neat question, neat technique, but this really isn't the site for it.
– Paul Cezanne
Sep 23, 2013 at 11:57

It's pretty simple, really.

Basically, this relies on the fact that the images must be saved in an uncompressed file.

If you think about how an image is stored, it's functionally a bunch of sequential numbers:

(PX 0,0 - R:x, G:y, B:z)
(PX 1,0 - R:x, G:y, B:z)
(PX 2,0 - R:x, G:y, B:z)
(PX 3,0 - R:x, G:y, B:z)
....
(PX 639,0 - R:x, G:y, B:z)
(PX 0,1 - R:x, G:y, B:z)
(PX 1,1 - R:x, G:y, B:z)
....
(PX 639,479 - R:x, G:y, B:z)


For most bitmaps, R, G, B are either 8 or 16 bit values (1 or 2 bytes). Therefore, the "image" is really just a very long sequence of numbers, with some agreed-upon way of mapping those numbers into pixel-positions and colors.

Now, how is an uncompressed audio file represented? Very, very similarly:

(Sample 0 - R:x, L:y)
(Sample 1 - R:x, L:y)
(Sample 2 - R:x, L:y)
(Sample 3 - R:x, L:y)
....
(Sample z-1 - R:x, L:y)
(Sample z - R:x, L:y)


Most audio samples are 16 bit (some are 24, it can vary) per sample. However, again, the audio file is really just a whole bunch of numbers, with a agreed-upon method for translating the sequences of numbers back into an audio stream.

Now that you understand how the files are structured, you can start to see how the audio effects relate to the images. First, since uncompressed images are generally stored in a raster-scanned topology, audio effects are primarily going to have a horizontal "smearing" effect.

Additionally, you can see that basically the effects are going to permute the images based on the effective horizontal frequency components of each horizontal row of pixels.

The "Random EQ" setting boosts some the frequency components of the horizontal edges in the image, and the rippling that surrounds each edge is a function of the impulse-response of the filter.

The "Distortion" image looks to be adding some high-frequency noise, in addition to some apparent posterization, which makes me think it may decimate the internal sample-values in some manner.

The "Bass-Boot" is clearly exaggerating the swings between wide areas of low-values (e.g. black) and high-values (e.g. light colours).

I'm not sure what exactly the phazer is doing (I don't know what it would sound like, so I can't extrapolate to the DSP it involves).