Unsupervised classification has emerged as a popular technique for pattern recognition, image processing and data mining. It has a crucial contribution in the resolution of the problems arising from content-based image retrieval. In this study, we present K_means clustering algorithm that partitions an image database in cluster of images similar. We adapt K_means method to a very special structure which is quadree. The goal is to minimize the search time of images similar to an image request. We associate to each image a quad-tree which represents the characteristics of the image and store a base of images in a data structure called generic quadtree. It minimizes the memory space of set of image by the sharing of common parts between quad trees and speeds up several operations applied to images. The image similarity is based on a distance computed from the differences between the quad trees encoding images.