A microbial biofilm is structured mainly by a protective sticky matrix of extracellular polymeric substances. The appreciation of such structures is useful for the microbiologist and can be subjective to the observer. Thus, quantifying the underlying images in useful parameters by means of an objective image segmentation process helps substantially to reduce errors in quantification. This paper proposes an approach to segmentation of biofilm images using optimal multilevel thresholding and indices of clustering validity. A comparison of automatically segmented images with manual segmentation is done through different thresholding criteria, and clustering validity indices are used to find the correct number of thresholds, obtaining results similar to the segmentation done by an expert.