A program calculating and analyzing the fractal dimension of the laser confocal scanning image for mechanical seal end face was developed by MATLAB based on fractal theory.The calculation result was calibrated by the Sierpinski carpet.The fractal dimension under different image segmentation threshold was calculated,and a method to select the appropriate segmentation threshold was proposed.The results show that the program has high accuracy and the segmentation threshold has a great influence on the fractal dimension of mechanical seal end face.The proposed method of selecting the segmentation threshold has the best effect of binaryzation on the images,and can make the laser confocal scanning image reflect the fractal characterization of surface topography for mechanical seal end face to a great degree so that the quantitative description of surface topography for mechanical sea end face will be more accurate.