Understanding proof that continuous image of connected is connected

Asserting that the image of $f$ is connected is asserting that $f(X)$ is connected. What happens in $Y\setminus f(X)$ does not matter. So, it is natural to assume from the start that $Y$ is just $f(X)$; in other words, that $f$ is surjective.