An approach to solving the problem of color or gray-scale image segmentation into regions of the same color is considered. The proposed algorithm is based on direct search for regions with the use of methods of working with lists, which are applied in logic programming and artificial intelligence systems.