To solve the difficulty in processing the weld image of multi-threshold and small size using the traditional image processing algorithms, image preprocessing has been optimized combining with the traditional mode of image processing. The maximum distance location algorithm and the line grey location algorithm have been designed on the basis of lines position combining with the specific characteristics of the weld image. These two algorithms are applied to process the weld image of multi-threshold and small size. Finally the wrong values of the weld images are removed according to the Pauta rule, thus achieving a linear correction of the edge. This paper introduces the basic ideas and the implementation methods of the two positioning algorithms in details. The experimental results show that the two algorithms can effectively resistant the interferences of noise, have a high precision positioning, and retain edge images with better detail characteristics.