It receives information about the spacial frequency content of the image. If you're unfamiliar, it's definitely worth looking into the specifics of how this works, as it's quite impressive! Here's a few relevant Wikipedia articles, and a Computerphile video:
https://en.wikipedia.org/wiki/JPEG#JPEG_codec_example
https://en.wikipedia.org/wiki/Discrete_cosine_transform
https://www.youtube.com/watch?v=Q2aEzeMDHMA