A similarity based image inpainting method is introduced in this paper, which can be used to automatically fill the regions needing to he erased by using the surrounding information in the image. The method is boxed on analyzing the previous image inpainting methods, especially improving the method proposed hy Criminisi et al. In nur method, a more robust method is adopted to compute the filling order, which overcome the problem arising when the image gradients of some pixels on the source region contour are just zeros. And a new mapping term is proposed in computing the matching cost to penalize the source regions repeatedly sampled, which practically avoid the artificial repetition problem in the inpainted results.