Image Corruptor: How to Corrupt JPEG & PNG Files (Testing + Glitch Art)

Posted on by CorruptAnyFile Team

Image Corruptor: How to Corrupt JPEG & PNG Files (Testing + Glitch Art)

Images are corrupted for two reasons: developers test how apps handle broken pictures, and artists create glitch effects. The methods differ, so this guide covers both.

Two goals, two approaches

Goal Aim Method
Testing Image will not open Damage header or structure
Glitch art Image opens but looks distorted Change a few data bytes

Corrupting an image for testing

Online image corruptor

  1. Open CorruptAnyFile.
  2. Upload your JPG, JPEG, PNG, GIF, BMP, WEBP or SVG.
  3. Click Corrupt My File.
  4. Download the file. It keeps its size but will not display.

How JPEG and PNG are built

  • JPEG: starts with the bytes FF D8 and ends with FF D9. Headers and tables follow, then compressed image data.
  • PNG: begins with an 8-byte signature (89 50 4E 47 0D 0A 1A 0A), then chunks such as IHDR (size), IDAT (pixels) and IEND (end). Each chunk has a checksum.

Altering the signature or the IHDR chunk makes viewers reject the file.

Creating glitch art

For a picture that still opens but looks distorted:

  1. Duplicate your JPEG.
  2. Open it in a hex editor.
  3. Skip the first few hundred bytes (they hold headers).
  4. Change or delete a few bytes in the middle of the data.
  5. Save and open the image.

Change only a small number of bytes at a time. Too much damage and the image will not open at all. JPEG is the best format for this, because errors spread into colored bands and shifted blocks. PNG often fails entirely, because each chunk has a checksum.

Example test cases for developers

  • Does your avatar upload reject a broken image?
  • Does your thumbnail generator crash?
  • Does your CDN return an error or a broken image icon?
  • Does your image optimizer hang?

Related guides

Corrupt a video, corrupt a PDF, and our overview, how to corrupt a file.

FAQ

How do I corrupt a JPEG? Upload it to CorruptAnyFile, or edit the header in a hex editor.

How do I make glitch art? Change a few bytes in the middle of a JPEG's data.

Why do PNGs break so easily? Each chunk carries a checksum, so changes are detected.