↑↑↑↑↑↑↑↑↑↑ Click here to try this out in your browser!
This Jupyter Notebook demonstrates how to decode and encode a JPEG image from scratch, as well as explaining all of the theory and algorithms involved.
It'll enable you to make horrors such as this:
or this:
In the process, you'll hopefully learn a lot of useful tools for understanding compression and multimedia more generally.