JPEG compression involves four key steps:
1) Applying the discrete cosine transform (DCT) to 8x8 pixel blocks, transforming spatial information to frequency information.
2) Quantizing the transformed coefficients, discarding less important high-frequency information to reduce file size.
3) Scanning coefficients in zigzag order to group similar frequencies together, further compressing the data.
4) Entropy encoding the output, typically using Huffman coding, to remove statistical redundancy and achieve further compression.