If $G_1,G_2$ are groups, $\varphi:G_1 \rightarrow G_2$ is a homomorphism and $a \in Z(G_1)$, is it true that $\varphi(a) \in Z(\operatorname{im}\varphi)$?
My attempt so far: I define $\varphi:G_1 \rightarrow G_2, \varphi(a)= \frac1a, a\in\mathbb Z$. which is not an integer. Also, $\varphi$ is a homomorphism since $a,b\in \mathbb Z :\varphi(ab)=\frac1a\frac{1}{b}$.
Is this a valid counterexample?