In this paper we are concerned with the classification of the subsets $A$ of $\Z_p$ which occur as images $f(\Z_p^r)$ of polynomial functions $f:\Z_p^r\to \Z_p$, limiting ourselves to compact-open subsets (i.e. finite unions of open balls). We shall prove three main results: (i) Every compact-open $A\subset \Z_p$ is of the shape $A=f(\Z_p^r)$ for suitable $r$ and $f\in\Z_p[X_1,\ldots ,X_r]$. (ii) For each $r_0$ there is a compact-open $A$ such that in (i) we cannot take $r<r_0$. (iii) For any compact-open set $A\subset \Z_p$ there exists a polynomial $f\in\Q_p[X]$ such that $f(\Z_p)=A$. We shall also discuss in more detail which sets $A$ can be represented as $f(\Z_p)$ for a polynomial $f\in\Z_p[X]$ in a single variable.