  The redshifts of galaxies are a key attribute that is needed for nearly all
extragalactic studies. Since spectroscopic redshifts require additional
telescope and human resources, millions of galaxies are known without
spectroscopic redshifts. Therefore, it is crucial to have methods for
estimating the redshift of a galaxy based on its photometric properties, the
so-called photo-$z$. We developed NetZ, a new method using a Convolutional
Neural Network (CNN) to predict the photo-$z$ based on galaxy images, in
contrast to previous methods which often used only the integrated photometry of
galaxies without their images. We use data from the Hyper Suprime-Cam Subaru
Strategic Program (HSC SSP) in five different filters as training data. The
network over the whole redshift range between 0 and 4 performs well overall and
especially in the high-$z$ range better than other methods on the same data. We
obtain an accuracy $|z_\text{pred}-z_\text{ref}|$ of $\sigma = 0.12$ (68%
confidence interval) with a CNN working for all galaxy types averaged over all
galaxies in the redshift range of 0 to $\sim$4. By limiting to smaller redshift
ranges or to Luminous Red Galaxies (LRGs), we find a further notable
improvement. We publish more than 34 million new photo-$z$ values predicted
with NetZ here. This shows that the new method is very simple and fast to
apply, and, importantly, covers a wide redshift range limited only by the
available training data. It is broadly applicable and beneficial to imaging
surveys, particularly upcoming surveys like the Rubin Observatory Legacy Survey
of Space and Time which will provide images of billions of galaxies with
similar image quality as HSC.
