The image inpainting algorithm based on total variation model is analyzed. For the different size of the gradient value of each reference point, an improved image inpainting algorithm is proposed. The algorithm constructs a spread function by calculating the gradient information of pixel, and then they are weighted. Spread function control the contribution of the reference point on the repair area. Experimental results show that this algorithm works better in repair of damaged images which changes dramatically and the region is larger. Also, the image sharp edges and the boundary transit naturally.