I keep a running list of random ideas in a gmail draft. Whenever I think of something mildly interesting, I jot it down so I can revisit it later. Most of the ideas aren’t very good, but every so often there’s a gem. Lately I’ve been working through some of them with Claude Code*, which is great for prototyping and quickly killing the ones that don’t pan out.
One idea on the list was JPEG generation loss. I’d seen a few demos years ago and thought they were fascinating. Claude told me it was a good idea and that I’d see the image decay with each save. That sounded good to me so I asked it to create a script, but it didn’t work. There was no obvious generation loss, even after 1000 saves. However, I remembered seeing demos showing jpegs disintegrating, so rather than dismiss the idea like I had others from the list, I tried making a script by hand, but that also didn’t produce the expected results. Then I tried making a Photoshop plugin (maybe there was something wrong with the libraries I was using?). But that also didn’t work.
Finally, out of frustration, I went back and found and rewatched the old demos that had originally piqued my interest, and I noticed they were randomizing the quality setting between saves. Changing the quality changes the quantization table, so that forces the data to be crunched differently between each save, which is what was causes the generation loss. The other demo I remembered wasn’t doing this, but there was someone in the comments saying that the generation loss shouldn’t occur (jpegs stabilize fairly quickly after repeated saves), which matched up with what I was seeing.
I didn’t find the idea of randomizing the quality to be very interesting (even if the effect was cool), so I decided to just start messing around. One idea that led to really cool results was saving an image as a jpeg, then as a lossy webp, then as a lossy avif, and then just repeating this. The image ended up melting into a magenta soup. Once I saw that, I felt I had something neat enough to be worth sharing. I made a short little video on it, you can see it below if you’re interested.
If you enjoy it, a like helps more than you’d think. And if you want to play with the script yourself, I’ve put it on GitHub: https://github.com/patorjk/image-generation-loss
* I may talk more about this later. I’m still pretty new to this and am probably behind the curve.









