All you need to know about JPEG compression

Compression is the art of removing redundant or duplicate information from a file or a set of bytes in such a way that the original content can be reconstituted (decompressed) at a later stage.

The compression algorithm we are perhaps most familiar with is zip compression – although it's more formally known as 'Deflate'. This is a good example of a 'lossless' compression algorithm: when you compress something with Deflate and then decompress it, you get exactly the same file back, using the same set of bytes.