One of the nice things about connectedness is that it’s preserved under continuous maps. It turns out that compactness is the same way — the image of a compact space under a continuous map is compact.
Let’s take an open cover of the image . Since is continuous, we can take the preimage of each of these open sets to get a bunch of open sets in . Clearly every point of is the preimage of some point of , so the form an open cover of . Then we can take a finite subcover by compactness of , picking out some finite collection of indices. Then looking back at the corresponding to these indices (instead of their preimages) we get a finite subcover of . Thus any open cover of the image has a finite subcover, and the image is compact.