Let $\phi: X \rightarrow Y$ be a morphism be varieties over an algebraically closed field. I'm trying to prove that $\phi(X)$ contains a nonempty open subset of $\overline{\phi(X)}$. I know how to solve the problem when $X$ and $Y$ are affine and irreducible with $\phi(X)$ dense in $Y$, and I'm trying to understand how we can reduce the problem to this case. I am generally having trouble with problems like this, I don't understand how people can reduce to the affine case so quickly.
So far I have reduced to the case where $Y$ is affine, and I'm currently trying to understand how to reduce further.
By a variety, I mean a locally ringed space of $k$-valued functions with a finite open cover by open affines. Here an affine variety is the maximal spectrum of a reduced finitely generated algebra over the (algebraically closed) field.