Proof (continuous image of connected set is connected)
Suppose $f(X)$ is disconnected. Let $f(X) = U\cup V$ be a separation. Then $f\inv(U)$ and $f\inv(V)$ are
-
non-empty since $U,V\subseteq f(X)$ are non-empty;
-
disjoint since $U,V$ are disjoint;
-
open since $U,V$ are open and $f$ is continuous.
Therefore $X = f\inv(U) \cup f\inv(V)$ is a separation of $X$.