Digital image processing is a very useful tool because it allows to highlight and extract image attributes that are undetectable by the naked eye. In this work, an algorithm that is able to identify the corners of a rectangular-shaped figure was developed. The figure have to contrast over a darker background than the figure itself. From this information, the processing system obtains the corresponding rectangular-shaped image, and eliminates all the superfluous background information. Then, the algorithm aligns the limits of the extracted figure with the ones of the original image. The performance of the designed code was tested and validated in most of the experimental cases.