Why an image can be made smaller at all
An uncompressed photograph is a straightforward list: for every pixel, how much red, green and blue it contains. A 12-megapixel photo is twelve million pixels at three bytes each, which is about 36 MB before anything clever happens.
Almost none of that data is surprising. The sky in the top-left corner is very close to the sky next to it. A wall is thousands of nearly identical pixels in a row. Compression exists because a description of an image is almost always shorter than a list of its pixels — and because a great deal of what is in that list is below the threshold at which human vision notices anything.
Every compression format is a different answer to two questions: which patterns are worth describing rather than listing, and how much of the detail can be dropped before someone complains.