In this article, we will present a optimized and automatized mechanism for improve digitalized documents that present some or even all problems described below. First we introduce briefly the concept of Connected Components, which are essential for the whole process. Then, we carry on with a technique for slant detection of document as well as a basic algorithm for image rotation. Next, we explain an easy method for detection and elimination of black borders and random points. Last, we propose an automated mechanism that integrates all these tasks in a big and organized restoration process.