The main task of digital image processing is to recognize properties of real objects based on their digital images. These images are obtained by some sampling device, like a CCD camera, and represented as finite sets of points that are assigned some value in a gray-level or color scale. Based on technical properties of sampling devices, these points are usually assumed to form a square grid and are modeled as finite subsets of Z2. Therefore, a fundamental question in digital image processing is which features in the digital image correspond, under certain conditions, to properties of the underlying objects. In practical applications this question is mostly answered by visually judging the obtained digital images. In this paper we present a comprehensive answer to this question with respect to topological properties. In particular, we derive conditions relating properties of real objects to the grid size of the sampling device which guarantee that a real object and its digital image are topologically equivalent. These conditions also imply that two digital images of a given object are topologically equivalent. This means, for example, that shifting or rotating an object or the camera cannot lead to topologically different images, i.e., topological properties of obtained digital images are invariant under shifting and rotation.