Semi-supervised image segmentation is an important issue in many image processing applications, and has been a popular research area recently, the most popular are graph-based methods. However, parameter selection in these methods is still largely heuristic. In this paper, we introduce distance metric learning into graph-based semi-supervised segmentation to automatically obtain good results for images with different appearances. We first derive the optimization problem with respect to the distance metric as well as the segmentation labels, and use gradient descent method to find a local optimum solution. Experiments on general images and the fungal disease analysis application have shown that our method provides a steady performance under casual user annotations and different image appearances.