Digital image processing has a significant impact in different research areas including medical image processing, biometrics, image inpainting, object detection, information hiding, and image compression. Image inpainting is a science of reconstructing damaged parts of digital images and filling-in regions in which information are missing which has many potential applications such as repairing scratched images, removing unwanted objects, filling missing area, and repairing old images. In this paper, an image inpainting algorithm is developed based on exemplar, which is one of the most important and popular images inpainting technique, to fill-in missing area that caused either by removing unwanted objects, by image compression, by scratching image, or by image transformation through internet. In general, image inpainting consists of two main steps: The first one is the priority function. In this step, the algorithm decides to select which patch has the highest priority to be filled at the first. The second step is the searching mechanism to find the most similar patch to the selected highest priority patch to be inpainted. This paper concerns the second step and an improved searching mechanism is proposed to select the most similar patch. The proposed approach entails three steps: (1) Euclidean distance is used to find the similarity between the highest priority patches which need to be inpainted with each patch of the input image, (2) the position/location distance between those two patches is calculated, and (3) the resulted value from the first step is summed with the resulted value obtained from the second step. These steps are repeated until the last patch from the input image is checked. Finally, the smallest distance value obtained in step 3 is selected as the most similar patch. Experimental results demonstrated that the proposed approach gained a higher quality in terms of both objectives and subjective compared to other existing algorithms.