In this paper, we propose an original indexing by shape of image databases based on extended grid files. We first introduce a recently developed shape description method and tailor it to obtain suitable representation structures for image databases. Then, in order to efficiently support image retrieval, we define an indexing structure based on grid files. Since grid files were originally developed to speed up point (exact match) and range (nearest neighbors within a threshold) queries on multidimensional data with a fixed number of attributes, we extend them to cope with data provided with a varying number of attributes and to deal with a new class of queries relevant to image databases, namely, nearest neighbor queries. We give a detailed description of the proposed search algorithms and a systematic analysis of their complexity, and discuss the outcomes of some experimental tests on sample image databases.