Image segmentation is a significant low-level method of the image processing area. As the matter of the fact that there is no selected certainty in interpreting the computer vision problems, there are many likely solutions. Some morphological methods used in image segmentation cause over-segmentation problems. Region merging, the usage of markers and the usage of multi-scale are the solutions for the over-segmentation problems found in the literature. However, these approaches give rise to under-segmentation problem. Simulated annealing (SA) is an optimization technique for soft computing. In our study, the problem of image segmentation is treated as a p-median (i.e., combinatorial optimization) problem. Therefore, the SA is used to solve p-median problem as a probabilistic metaheuristic. In the optimization method that is introduced in this paper, optimal threshold has been obtained for bi-level segmentation of grayscale images using our entropy-based simulated annealing (ESA) method. In addition, this threshold is used in determining optimal contour for edge-based image segmentation of grayscale images. Compared to the available methods (i.e., Otsu, only-entropy and Snake method) in the literature, our ESA method is more feasible in terms of performance measurements, threshold values and coverage area ratio of the region of interest (ROI). (C) 2010 Elsevier B. V. All rights reserved.