Huffman Hacking

When databending an image in a text editor, you generally want to avoid editing any of the text towards the top of the file. This is because the top of the file contains the "header" and as explained in the section on creating a BMP from scratch, the tiniest change to the header can prevent an image viewer from knowing where to even begin decoding the image data. That said, as explained in the Databending section, using a hex editor you can look for certain "markers" in a header to execute a variety of header related hacks. One example is hacking the Huffman tables in a JPEG file.

This appendix allows you to upload (or drag and drop) a JPEG file and it will extract, and allow you to edit, the Huffman table bytes form the JPEG's header. This tool is largely inspired by HEADer_REMIX (2009) by Ted Davis. To learn more about Huffman encoding (which is used to compress more than just images) check out this great video by Tom Scott. To learn more about how JPEG compression works (and what else is contained in their headers) check out this amazing interactive post Unraveling the JPEG by Omar Shehata.

back to index