If you are interested in learning how JPEG and Image Compression works, try checking out the links attached below.
-
Fourier Analysis-A bigger picture-Can skip this one if you do not wanna go behind the maths involved in DCT
-
https://cs.stanford.edu/people/eroberts/courses/soco/projects/data-compression/lossy/jpeg/dct.htm